diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-21 15:37:11 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-21 15:37:11 (GMT) |
commit | e6af7e74a901bc4971a70750a81558ea474d55d7 (patch) | |
tree | 1394b61866ad31f67d6a7165b1a2a9eaae497326 /src/gui/itemviews | |
parent | 9dbba618af3b505c0aac590d0b0ec32eabb76d76 (diff) | |
parent | 05500482c4b7f810bd4c073739bdedf0b8783738 (diff) | |
download | Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.zip Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.tar.gz Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.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: (75 commits)
Autotests: if you use X11 libs, you must link to X11 libs explicitly.
Disable C++0x mode for QtWebKit and QtScript since WebKit will not compile any time soon with C++0x
Compile Phonon in C++0x mode.
Compile Qt in C++0x mode.
Avoid a data relocation by not trying to store a pointer in the .data section of plugins.
Fix cast-from-ascii warning
Fix compilation on Linux
Fix compilation with WINSCW: #include doesn't find files in the same dir
Rename m_volume to m_vol
Add 2 signals, introduce side widget, make it possible to reset startId
Do not create native window handle just because a parent has one.
Tab color fix for document mode on Snow Leopard.
Revert "Don't emit open signal on session close/error."
Rename networkAccess property to networkAccessible.
Don't emit open signal on session close/error.
Rename private signal.
Autotest: fix instability by accepting rounding errors
Dont force height for filter widget
- Fix importdir option on unix/linux configure
Remove incorrect semi-colons after Q_PROPERTY
...
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 10 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview_p.h | 5 | ||||
-rw-r--r-- | src/gui/itemviews/qitemdelegate.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 15 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 0f99949..7a1ea10 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/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 7d8e103..cba213b 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1023,7 +1023,7 @@ QPixmap QItemDelegate::decoration(const QStyleOptionViewItem &option, const QVar // hacky but faster version of "QString::sprintf("%d-%d", i, enabled)" static QString qPixmapSerial(quint64 i, bool enabled) { - ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', '0' + enabled }; + ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', ushort('0' + enabled) }; ushort *ptr = &arr[16]; while (i > 0) { diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 61ad79d..b2457f3 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())) { @@ -2156,9 +2157,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(); @@ -2178,7 +2180,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; } } @@ -2190,6 +2195,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) { @@ -2212,7 +2218,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(); |