summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qtreeview.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-03-24 23:06:43 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-03-24 23:06:43 (GMT)
commitd20510dd91e01b15e2346c0cb12e352080b6a093 (patch)
tree83554f5c96f69df6fe6d9d5c2a9f529a3b1316d8 /src/gui/itemviews/qtreeview.cpp
parentf727f993c3c4e3f548b06d57b3ee0da4f3914bae (diff)
parent8218a16815d883823d3411be9896332b997f3e91 (diff)
downloadQt-d20510dd91e01b15e2346c0cb12e352080b6a093.zip
Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.gz
Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Conflicts: src/plugins/bearer/corewlan/qcorewlanengine.mm
Diffstat (limited to 'src/gui/itemviews/qtreeview.cpp')
-rw-r--r--src/gui/itemviews/qtreeview.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index b2457f3..d934683 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -674,15 +674,19 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
// refresh the height cache here; we don't really lose anything by getting the size hint,
// since QAbstractItemView::dataChanged() will get the visualRect for the items anyway
- int topViewIndex = d->viewIndex(topLeft);
- if (topViewIndex == 0)
- d->defaultItemHeight = indexRowSizeHint(topLeft);
bool sizeChanged = false;
+ int topViewIndex = d->viewIndex(topLeft);
+ if (topViewIndex == 0) {
+ int newDefaultItemHeight = indexRowSizeHint(topLeft);
+ sizeChanged = d->defaultItemHeight != newDefaultItemHeight;
+ d->defaultItemHeight = newDefaultItemHeight;
+ }
+
if (topViewIndex != -1) {
if (topLeft.row() == bottomRight.row()) {
int oldHeight = d->itemHeight(topViewIndex);
d->invalidateHeightCache(topViewIndex);
- sizeChanged = (oldHeight != d->itemHeight(topViewIndex));
+ sizeChanged |= (oldHeight != d->itemHeight(topViewIndex));
if (topLeft.column() == 0)
d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft);
} else {
@@ -958,17 +962,16 @@ void QTreeView::keyboardSearch(const QString &search)
else
start = d->model->index(0, 0, d->root);
- QElapsedTimer now;
- now.start();
bool skipRow = false;
- if (search.isEmpty()
- || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) {
+ bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
+ qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart();
+ if (search.isEmpty() || !keyboardTimeWasValid
+ || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) {
d->keyboardInput = search;
- skipRow = true;
+ skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0)
} else {
d->keyboardInput += search;
}
- d->keyboardInputTime = now;
// special case for searches with same key like 'aaaaa'
bool sameKey = false;