diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-04 12:21:10 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-04 12:21:10 (GMT) |
commit | 4a079000243ed05ce37d3c7055b5bd56c7ccf85d (patch) | |
tree | 3bb9bf991e13a8e211cd9c56c0adb249ebe1a697 /src/gui/itemviews/qabstractitemview.cpp | |
parent | 5dec3808ed6724a096e5dfc579d37e8528de75e0 (diff) | |
parent | c368a8ed6badab846c8e63c26d48b95788c12163 (diff) | |
download | Qt-4a079000243ed05ce37d3c7055b5bd56c7ccf85d.zip Qt-4a079000243ed05ce37d3c7055b5bd56c7ccf85d.tar.gz Qt-4a079000243ed05ce37d3c7055b5bd56c7ccf85d.tar.bz2 |
Merge commit 'origin/4.5'
Conflicts:
src/gui/itemviews/qabstractitemview.cpp
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index cc14d3e..4e4392f 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -88,6 +88,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() autoScroll(true), autoScrollMargin(16), autoScrollCount(0), + shouldScrollToCurrentOnShow(false), alternatingColors(false), textElideMode(Qt::ElideRight), verticalScrollMode(QAbstractItemView::ScrollPerItem), @@ -1380,8 +1381,9 @@ bool QAbstractItemView::event(QEvent *event) d->executePostedLayout(); //make sure we set the layout properly break; case QEvent::Show: - if (d->delayedPendingLayout) { - d->executePostedLayout(); //make sure we set the layout properly + d->executePostedLayout(); //make sure we set the layout properly + if (d->shouldScrollToCurrentOnShow) { + d->shouldScrollToCurrentOnShow = false; const QModelIndex current = currentIndex(); if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll)) scrollTo(current); @@ -3160,13 +3162,18 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI update(previous); } } - if (isVisible() && current.isValid() && !d->autoScrollTimer.isActive()) { - if (d->autoScroll) - scrollTo(current); - update(current); - edit(current, CurrentChanged, 0); - if (current.row() == (d->model->rowCount(d->root) - 1)) - d->_q_fetchMore(); + + if (current.isValid() && !d->autoScrollTimer.isActive()) { + if (isVisible()) { + if (d->autoScroll) + scrollTo(current); + update(current); + edit(current, CurrentChanged, 0); + if (current.row() == (d->model->rowCount(d->root) - 1)) + d->_q_fetchMore(); + } else { + d->shouldScrollToCurrentOnShow = d->autoScroll; + } } } |