diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-23 03:01:51 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-23 03:01:51 (GMT) |
commit | e488b62271d89bb4056ad9b98903f8530917a4a0 (patch) | |
tree | 90f7e6d0ba3ff56c47e42848ae5eb33af45b135b | |
parent | 3fa7e7d082de97abfb50d28f25f22185deabd82d (diff) | |
parent | f50f94512a22b311277ba07e09cf59e2c73bb25c (diff) | |
download | Qt-e488b62271d89bb4056ad9b98903f8530917a4a0.zip Qt-e488b62271d89bb4056ad9b98903f8530917a4a0.tar.gz Qt-e488b62271d89bb4056ad9b98903f8530917a4a0.tar.bz2 |
Merge remote branch 'origin/4.7' into oslo-staging-1
Conflicts:
src/gui/itemviews/qabstractitemview.cpp
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 4 | ||||
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel.cpp | 88 | ||||
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 2 | ||||
-rw-r--r-- | src/opengl/qglbuffer.cpp | 24 |
5 files changed, 57 insertions, 63 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 7a1ea10..d7ddf4e 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) moveCursorUpdatedView(false) { } @@ -132,8 +132,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) |