diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-05-12 12:11:55 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-05-12 12:11:55 (GMT) |
commit | f5ac9ac1387fb9aac7c74d686f0b247ac50746e1 (patch) | |
tree | 8efb9b6c1029f8b9c26b96fa5389b1b0623c5163 /src/gui/itemviews/qabstractitemview.cpp | |
parent | cb369071fa9b15e68f91d2883ee29f12c58fc803 (diff) | |
parent | bc184432c49eb56254bc5db07c6af03718c6b0e7 (diff) | |
download | Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.zip Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.gz Qt-f5ac9ac1387fb9aac7c74d686f0b247ac50746e1.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 55b3a03..83e05b4 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: - { - 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); @@ -3163,14 +3165,18 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI d->updateDirtyRegion(); } } - if (isVisible() && current.isValid() && !d->autoScrollTimer.isActive()) { - if (d->autoScroll) - scrollTo(current); - d->setDirtyRegion(visualRect(current)); - d->updateDirtyRegion(); - 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); + d->setDirtyRegion(visualRect(current)); + d->updateDirtyRegion(); + edit(current, CurrentChanged, 0); + if (current.row() == (d->model->rowCount(d->root) - 1)) + d->_q_fetchMore(); + } else { + d->shouldScrollToCurrentOnShow = d->autoScroll; + } } } |