diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-16 09:56:15 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-16 09:56:15 (GMT) |
commit | e0dd5b450e1b04feb6c72a3c635c586b244392da (patch) | |
tree | 719dce69a0712aa6d896d752c0d7d6b93b0e72a5 /src/gui/itemviews/qabstractitemview.cpp | |
parent | b912cac358a0a84f72f727767772caad22062a45 (diff) | |
download | Qt-e0dd5b450e1b04feb6c72a3c635c586b244392da.zip Qt-e0dd5b450e1b04feb6c72a3c635c586b244392da.tar.gz Qt-e0dd5b450e1b04feb6c72a3c635c586b244392da.tar.bz2 |
Revert "small cleanup regarding delayed layout in itemviews"
This reverts commit 8e98c4c159c38ea48b6321674105762b2d3f517b.
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 61defdc..fb6e418 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -103,7 +103,8 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() verticalScrollMode(QAbstractItemView::ScrollPerItem), horizontalScrollMode(QAbstractItemView::ScrollPerItem), currentIndexSet(false), - wrapItemText(false) + wrapItemText(false), + delayedPendingLayout(false) { } @@ -2397,8 +2398,9 @@ void QAbstractItemView::timerEvent(QTimerEvent *event) d->delayedEditing.stop(); edit(currentIndex()); } else if (event->timerId() == d->delayedLayout.timerId()) { - d->interruptDelayedItemsLayout(); + d->delayedLayout.stop(); if (isVisible()) { + d->interruptDelayedItemsLayout(); doItemsLayout(); const QModelIndex current = currentIndex(); if (current.isValid() && d->state == QAbstractItemView::EditingState) @@ -3060,7 +3062,7 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget d->addEditor(index, widget, true); widget->show(); dataChanged(index, index); // update the geometry - if (!d->delayedPendingLayout()) + if (!d->delayedPendingLayout) widget->setGeometry(visualRect(index)); } } @@ -3100,7 +3102,7 @@ void QAbstractItemView::scrollToTop() void QAbstractItemView::scrollToBottom() { Q_D(QAbstractItemView); - if (d->delayedPendingLayout()) { + if (d->delayedPendingLayout) { d->executePostedLayout(); updateGeometries(); } @@ -3145,14 +3147,14 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde delegate->setEditorData(editorInfo.editor, topLeft); } } - if (isVisible() && !d->delayedPendingLayout()) { + if (isVisible() && !d->delayedPendingLayout) { // otherwise the items will be update later anyway update(topLeft); } return; } d->updateEditorData(topLeft, bottomRight); - if (!isVisible() || d->delayedPendingLayout()) + if (!isVisible() || d->delayedPendingLayout) return; // no need to update d->viewport->update(); } @@ -3876,6 +3878,22 @@ bool QAbstractItemViewPrivate::shouldAutoScroll(const QPoint &pos) const || (area.right() - pos.x() < autoScrollMargin); } +void QAbstractItemViewPrivate::doDelayedItemsLayout(int delay) +{ + if (!delayedPendingLayout) { + delayedPendingLayout = true; + delayedLayout.start(delay, q_func()); + } +} + +void QAbstractItemViewPrivate::interruptDelayedItemsLayout() const +{ + delayedLayout.stop(); + delayedPendingLayout = false; +} + + + QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, const QStyleOptionViewItem &options) { |