summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-17 17:31:53 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-17 17:31:53 (GMT)
commit48d3561b69adfc59b7b413dfc6f0857a8560b815 (patch)
tree3ad12dda36eb311b6209a228eca66c5892b41746 /src/gui/itemviews
parent4c1f54097a1fb1acff817ba8caa8af347ae56cd2 (diff)
parentd6ab68fbd22b2d057b0e32e1bfc73a5e7dc9327d (diff)
downloadQt-48d3561b69adfc59b7b413dfc6f0857a8560b815.zip
Qt-48d3561b69adfc59b7b413dfc6f0857a8560b815.tar.gz
Qt-48d3561b69adfc59b7b413dfc6f0857a8560b815.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (38 commits) Force qt-zlib to be used for host system when cross compiling. qmake: fix to create proper install target in Makefile at first run compile fix for Windows Fixed focus handling when Qt is embedded into Cocoa app. Do not beep on Mac when pressing some keys. Do not deliver the same key event multiple times in Cocoa. Implement Idle-priority threads for Linux. Improved qt_x11_wait_for_window_manager Doc: document QElapsedTimer Added missing "const" for mac. qdoc3: Fixed some ifdef typos and removed some whitespace. Manual test for QTBUG-8933. Cocoa: minisplitter has only 1px wide grab area "Strictly" Fullscreen Application in Mac OS Bugfix the Symbian implementation Add QDateTime::currentDateTimeUtc and QDateTime::currentMsecsSinceEpoch remove, fixup Change the 32-bit rollover on Windows and Symbian to be more efficient. Add a couple of extra functions to QElapsedTimer Autotest: Rename the test to match the new class name ...
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp10
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h5
-rw-r--r--src/gui/itemviews/qtreeview.cpp15
3 files changed, 23 insertions, 7 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index dd9a7e6..fc53ea3 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -104,7 +104,8 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
horizontalScrollMode(QAbstractItemView::ScrollPerItem),
currentIndexSet(false),
wrapItemText(false),
- delayedPendingLayout(false)
+ delayedPendingLayout(false),
+ moveCursorUpdatedView(false)
{
}
@@ -2210,6 +2211,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
#endif
QPersistentModelIndex newCurrent;
+ d->moveCursorUpdatedView = false;
switch (event->key()) {
case Qt::Key_Down:
newCurrent = moveCursor(MoveDown, event->modifiers());
@@ -2266,6 +2268,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
QRect rect(d->pressedPosition - d->offset(), QSize(1, 1));
setSelection(rect, command);
}
+ event->accept();
return;
}
}
@@ -2363,6 +2366,8 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
}
break; }
}
+ if (d->moveCursorUpdatedView)
+ event->accept();
}
/*!
@@ -2839,7 +2844,8 @@ void QAbstractItemView::keyboardSearch(const QString &search)
QModelIndex start = currentIndex().isValid() ? currentIndex()
: d->model->index(0, 0, d->root);
- QTime now(QTime::currentTime());
+ QElapsedTimer now;
+ now.start();
bool skipRow = false;
if (search.isEmpty()
|| (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) {
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 82fd1a6..fce74f3 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -56,7 +56,6 @@
#include "private/qabstractscrollarea_p.h"
#include "private/qabstractitemmodel_p.h"
#include "QtGui/qapplication.h"
-#include "QtCore/qdatetime.h"
#include "QtGui/qevent.h"
#include "QtGui/qmime.h"
#include "QtGui/qpainter.h"
@@ -65,6 +64,7 @@
#include "QtCore/qdebug.h"
#include "QtGui/qpainter.h"
#include "QtCore/qbasictimer.h"
+#include "QtCore/qelapsedtimer.h"
#ifndef QT_NO_ITEMVIEWS
@@ -390,7 +390,7 @@ public:
#endif
QString keyboardInput;
- QTime keyboardInputTime;
+ QElapsedTimer keyboardInputTime;
bool autoScroll;
QBasicTimer autoScrollTimer;
@@ -419,6 +419,7 @@ public:
bool wrapItemText;
mutable bool delayedPendingLayout;
+ bool moveCursorUpdatedView;
private:
mutable QBasicTimer delayedLayout;
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 4135ba0..95ba67c 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -958,7 +958,8 @@ void QTreeView::keyboardSearch(const QString &search)
else
start = d->model->index(0, 0, d->root);
- QTime now(QTime::currentTime());
+ QElapsedTimer now;
+ now.start();
bool skipRow = false;
if (search.isEmpty()
|| (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) {
@@ -2138,9 +2139,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
return d->modelIndex(d->above(vi), current.column());
case MoveLeft: {
QScrollBar *sb = horizontalScrollBar();
- if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum())
+ if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) {
d->collapse(vi, true);
- else {
+ d->moveCursorUpdatedView = true;
+ } else {
bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this);
if (descend) {
QModelIndex par = current.parent();
@@ -2160,7 +2162,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
return next;
}
+ int oldValue = sb->value();
sb->setValue(sb->value() - sb->singleStep());
+ if (oldValue != sb->value())
+ d->moveCursorUpdatedView = true;
}
}
@@ -2172,6 +2177,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
if (vi < d->viewItems.count() && !d->viewItems.at(vi).expanded && d->itemsExpandable
&& d->hasVisibleChildren(d->viewItems.at(vi).index)) {
d->expand(vi, true);
+ d->moveCursorUpdatedView = true;
} else {
bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this);
if (descend) {
@@ -2194,7 +2200,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
//last restort: we change the scrollbar value
QScrollBar *sb = horizontalScrollBar();
+ int oldValue = sb->value();
sb->setValue(sb->value() + sb->singleStep());
+ if (oldValue != sb->value())
+ d->moveCursorUpdatedView = true;
}
}
updateGeometries();