summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtableview.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-11 12:39:09 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-11 12:39:09 +0200
commit5e2b0aa1b344bc93af29d7977aa7e497bfc7a9cf (patch)
treec478b00d1c04166f3c1c163971edb4575b065b13 /src/widgets/itemviews/qtableview.cpp
parentd1622207ba501b93bd83b88d61a5631d3d0da0cc (diff)
parentfda40e37df1152b5a8c572fe4bc53620bfcbcc45 (diff)
Merge remote branch 'staging/master' into refactor
Conflicts: src/gui/painting/qdrawhelper_p.h src/gui/painting/qgraphicssystemfactory.cpp src/gui/painting/qpainter.cpp src/gui/painting/qunifiedtoolbarsurface_mac.cpp src/gui/painting/qunifiedtoolbarsurface_mac_p.h src/openvg/openvg.pro src/openvg/qpaintengine_vg.cpp src/openvg/qwindowsurface_vg.cpp src/openvg/qwindowsurface_vgegl.cpp src/plugins/platforms/wayland/qwaylanddisplay.cpp src/widgets/graphicsview/qgraphicsscene.cpp
Diffstat (limited to 'src/widgets/itemviews/qtableview.cpp')
-rw-r--r--src/widgets/itemviews/qtableview.cpp22
1 files changed, 20 insertions, 2 deletions
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();
}