diff options
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractproxymodel.cpp | 24 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractproxymodel.h | 3 | ||||
-rw-r--r-- | src/widgets/itemviews/qdatawidgetmapper.cpp | 2 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemselectionmodel.cpp | 7 | ||||
-rw-r--r-- | src/widgets/itemviews/qtableview.cpp | 22 | ||||
-rw-r--r-- | src/widgets/itemviews/qtableview.h | 1 |
6 files changed, 25 insertions, 34 deletions
diff --git a/src/widgets/itemviews/qabstractproxymodel.cpp b/src/widgets/itemviews/qabstractproxymodel.cpp index 34ca7dff50..82b6c8d26a 100644 --- a/src/widgets/itemviews/qabstractproxymodel.cpp +++ b/src/widgets/itemviews/qabstractproxymodel.cpp @@ -121,15 +121,12 @@ QAbstractProxyModel::~QAbstractProxyModel() void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel) { Q_D(QAbstractProxyModel); - if (d->model) { + if (d->model) disconnect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed())); - disconnect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData())); - } if (sourceModel) { d->model = sourceModel; connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed())); - connect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData())); } else { d->model = QAbstractItemModelPrivate::staticEmptyModel(); } @@ -383,25 +380,6 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const return d->model->supportedDropActions(); } -/* - \since 4.8 - - This slot is called just after the internal data of a model is cleared - while it is being reset. - - This slot is provided the convenience of subclasses of concrete proxy - models, such as subclasses of QSortFilterProxyModel which maintain extra - data. - - \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10 - - \sa modelAboutToBeReset(), modelReset() -*/ -void QAbstractProxyModel::resetInternalData() -{ - -} - QT_END_NAMESPACE #include "moc_qabstractproxymodel.cpp" diff --git a/src/widgets/itemviews/qabstractproxymodel.h b/src/widgets/itemviews/qabstractproxymodel.h index 6e485aec12..4f3bc18448 100644 --- a/src/widgets/itemviews/qabstractproxymodel.h +++ b/src/widgets/itemviews/qabstractproxymodel.h @@ -95,9 +95,6 @@ public: QStringList mimeTypes() const; Qt::DropActions supportedDropActions() const; -protected Q_SLOTS: - void resetInternalData(); - protected: QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index 745ef5af91..dac4613071 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -291,7 +291,7 @@ void QDataWidgetMapperPrivate::_q_modelDestroyed() \snippet doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp 0 After the call to toFirst(), \c mySpinBox displays the value \c{1}, \c myLineEdit - displays \c {Nokia Corporation and/or its subsidiary(-ies)} and \c myCountryChooser displays \c{Oslo}. The + displays \c{Qt Norway} and \c myCountryChooser displays \c{Oslo}. The navigational functions toFirst(), toNext(), toPrevious(), toLast() and setCurrentIndex() can be used to navigate in the model and update the widgets with contents from the model. diff --git a/src/widgets/itemviews/qitemselectionmodel.cpp b/src/widgets/itemviews/qitemselectionmodel.cpp index 27a4a402e2..0b6445298e 100644 --- a/src/widgets/itemviews/qitemselectionmodel.cpp +++ b/src/widgets/itemviews/qitemselectionmodel.cpp @@ -1145,11 +1145,8 @@ void QItemSelectionModel::clearSelection() Q_D(QItemSelectionModel); if (d->ranges.count() == 0 && d->currentSelection.count() == 0) return; - QItemSelection selection = d->ranges; - selection.merge(d->currentSelection, d->currentCommand); - d->ranges.clear(); - d->currentSelection.clear(); - emit selectionChanged(QItemSelection(), selection); + + select(QItemSelection(), Clear); } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index e494ee5564..e70f3569aa 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1104,6 +1104,21 @@ void QTableView::setRootIndex(const QModelIndex &index) /*! \reimp */ +void QTableView::doItemsLayout() +{ + Q_D(QTableView); + QAbstractItemView::doItemsLayout(); + if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) + d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); + else + d->verticalHeader->setOffset(verticalScrollBar()->value()); + if (!d->verticalHeader->updatesEnabled()) + d->verticalHeader->setUpdatesEnabled(true); +} + +/*! + \reimp +*/ void QTableView::setSelectionModel(QItemSelectionModel *selectionModel) { Q_D(QTableView); @@ -1285,7 +1300,6 @@ void QTableView::paintEvent(QPaintEvent *event) const QPen gridPen = QPen(gridColor, 0, d->gridStyle); const QHeaderView *verticalHeader = d->verticalHeader; const QHeaderView *horizontalHeader = d->horizontalHeader; - const QStyle::State state = option.state; const bool alternate = d->alternatingColors; const bool rightToLeft = isRightToLeft(); @@ -1975,9 +1989,13 @@ QModelIndexList QTableView::selectedIndexes() const previous number of rows is specified by \a oldCount, and the new number of rows is specified by \a newCount. */ -void QTableView::rowCountChanged(int /*oldCount*/, int /*newCount*/ ) +void QTableView::rowCountChanged(int oldCount, int newCount ) { Q_D(QTableView); + //when removing rows, we need to disable updates for the header until the geometries have been + //updated and the offset has been adjusted, or we risk calling paintSection for all the sections + if (newCount < oldCount) + d->verticalHeader->setUpdatesEnabled(false); d->doDelayedItemsLayout(); } diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h index 0ef5daf0ef..7dfe262b6d 100644 --- a/src/widgets/itemviews/qtableview.h +++ b/src/widgets/itemviews/qtableview.h @@ -71,6 +71,7 @@ public: void setModel(QAbstractItemModel *model); void setRootIndex(const QModelIndex &index); void setSelectionModel(QItemSelectionModel *selectionModel); + void doItemsLayout(); QHeaderView *horizontalHeader() const; QHeaderView *verticalHeader() const; |