summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-22 20:39:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-22 20:39:04 (GMT)
commitf50f94512a22b311277ba07e09cf59e2c73bb25c (patch)
treef8e21ffac9394ea3c6af41c878daa4634ef12eee
parent58e9855afce71448c709469270950e5add87d601 (diff)
parent8f6b8c5a9750d49e6b93804d37aa64140460bfa6 (diff)
downloadQt-f50f94512a22b311277ba07e09cf59e2c73bb25c.zip
Qt-f50f94512a22b311277ba07e09cf59e2c73bb25c.tar.gz
Qt-f50f94512a22b311277ba07e09cf59e2c73bb25c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fix a problem with the selection losing items when layout is changed refactor connections/disconnections in QItemSelectionModel small little change to the initialization of item views disable copy of QPainterPathStroker as its not copiable. Added warnings on non-created buffer in QGLBuffer
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp88
-rw-r--r--src/gui/itemviews/qitemselectionmodel_p.h2
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/opengl/qglbuffer.cpp24
5 files changed, 57 insertions, 63 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 0f99949..a4722f7 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -104,7 +104,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
horizontalScrollMode(QAbstractItemView::ScrollPerItem),
currentIndexSet(false),
wrapItemText(false),
- delayedPendingLayout(false)
+ delayedPendingLayout(true)
{
}
@@ -131,8 +131,6 @@ void QAbstractItemViewPrivate::init()
viewport->setBackgroundRole(QPalette::Base);
- doDelayedItemsLayout();
-
q->setAttribute(Qt::WA_InputMethodEnabled);
#ifdef QT_SOFTKEYS_ENABLED
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index cab002e..d6e68f6 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -527,6 +527,27 @@ void QItemSelection::split(const QItemSelectionRange &range,
}
}
+
+void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model)
+{
+ this->model = model;
+ if (model) {
+ Q_Q(QItemSelectionModel);
+ QObject::connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
+ q, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
+ q, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
+ q, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
+ q, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(layoutAboutToBeChanged()),
+ q, SLOT(_q_layoutAboutToBeChanged()));
+ QObject::connect(model, SIGNAL(layoutChanged()),
+ q, SLOT(_q_layoutChanged()));
+ }
+}
+
/*!
\internal
@@ -793,6 +814,10 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
while (++i < colSpans.count()) {
QModelIndex nextTl = colSpans.at(i).topLeft();
QModelIndex nextBr = colSpans.at(i).bottomRight();
+
+ if (nextTl.parent() != tl.parent())
+ break; // we can't merge selection ranges from different parents
+
if ((nextTl.column() == prevTl.column()) && (nextBr.column() == br.column())
&& (nextTl.row() == prevTl.row() + 1) && (nextBr.row() == br.row() + 1)) {
br = nextBr;
@@ -890,21 +915,7 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
: QObject(*new QItemSelectionModelPrivate, model)
{
- d_func()->model = model;
- if (model) {
- connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
- connect(model, SIGNAL(layoutChanged()),
- this, SLOT(_q_layoutChanged()));
- }
+ d_func()->initModel(model);
}
/*!
@@ -913,21 +924,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)
: QObject(*new QItemSelectionModelPrivate, parent)
{
- d_func()->model = model;
- if (model) {
- connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
- connect(model, SIGNAL(layoutChanged()),
- this, SLOT(_q_layoutChanged()));
- }
+ d_func()->initModel(model);
}
/*!
@@ -936,21 +933,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *par
QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model)
: QObject(dd, model)
{
- d_func()->model = model;
- if (model) {
- connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
- connect(model, SIGNAL(layoutChanged()),
- this, SLOT(_q_layoutChanged()));
- }
+ dd.initModel(model);
}
/*!
@@ -958,21 +941,6 @@ QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstra
*/
QItemSelectionModel::~QItemSelectionModel()
{
- Q_D(QItemSelectionModel);
- if (d->model) {
- disconnect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
- disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
- disconnect(d->model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
- disconnect(d->model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
- disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
- disconnect(d->model, SIGNAL(layoutChanged()),
- this, SLOT(_q_layoutChanged()));
- }
}
/*!
diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h
index 30583b2..5afa90d 100644
--- a/src/gui/itemviews/qitemselectionmodel_p.h
+++ b/src/gui/itemviews/qitemselectionmodel_p.h
@@ -70,6 +70,8 @@ public:
QItemSelection expandSelection(const QItemSelection &selection,
QItemSelectionModel::SelectionFlags command) const;
+ void initModel(QAbstractItemModel *model);
+
void _q_rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
void _q_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 296ce33..15d83b8 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -288,6 +288,8 @@ public:
QPainterPath createStroke(const QPainterPath &path) const;
private:
+ Q_DISABLE_COPY(QPainterPathStroker)
+
friend class QX11PaintEngine;
QScopedPointer<QPainterPathStrokerPrivate> d_ptr;
diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp
index 2ab7c32..755f34c 100644
--- a/src/opengl/qglbuffer.cpp
+++ b/src/opengl/qglbuffer.cpp
@@ -289,6 +289,10 @@ bool QGLBuffer::read(int offset, void *data, int count)
*/
void QGLBuffer::write(int offset, const void *data, int count)
{
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::allocate(): buffer not created");
+#endif
Q_D(QGLBuffer);
if (d->guard.id())
glBufferSubData(d->type, offset, count, data);
@@ -305,6 +309,10 @@ void QGLBuffer::write(int offset, const void *data, int count)
*/
void QGLBuffer::allocate(const void *data, int count)
{
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::allocate(): buffer not created");
+#endif
Q_D(QGLBuffer);
if (d->guard.id())
glBufferData(d->type, count, data, d->actualUsagePattern);
@@ -336,6 +344,10 @@ void QGLBuffer::allocate(const void *data, int count)
*/
bool QGLBuffer::bind() const
{
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::bind(): buffer not created");
+#endif
Q_D(const QGLBuffer);
GLuint bufferId = d->guard.id();
if (bufferId) {
@@ -364,6 +376,10 @@ bool QGLBuffer::bind() const
*/
void QGLBuffer::release() const
{
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::release(): buffer not created");
+#endif
Q_D(const QGLBuffer);
if (d->guard.id())
glBindBuffer(d->type, 0);
@@ -453,6 +469,10 @@ int QGLBuffer::size() const
void *QGLBuffer::map(QGLBuffer::Access access)
{
Q_D(QGLBuffer);
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::map(): buffer not created");
+#endif
if (!d->guard.id())
return 0;
if (!glMapBufferARB)
@@ -476,6 +496,10 @@ void *QGLBuffer::map(QGLBuffer::Access access)
bool QGLBuffer::unmap()
{
Q_D(QGLBuffer);
+#ifndef QT_NO_DEBUG
+ if (!isCreated())
+ qWarning("QGLBuffer::unmap(): buffer not created");
+#endif
if (!d->guard.id())
return false;
if (!glUnmapBufferARB)