diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-05-12 12:54:50 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-05-12 12:54:50 (GMT) |
commit | 51a5901a26169276131c88aab3184fb0fa5b814c (patch) | |
tree | 637f660dc016b9479c9a510dc5e46e4617dd74e1 /src/gui | |
parent | a81cc0add7f9517dfbd31bb9988ab6bdc08c2b96 (diff) | |
download | Qt-51a5901a26169276131c88aab3184fb0fa5b814c.zip Qt-51a5901a26169276131c88aab3184fb0fa5b814c.tar.gz Qt-51a5901a26169276131c88aab3184fb0fa5b814c.tar.bz2 |
Double-click support for virtual cursor in Symbian
This makes it possible to use itemviews with S60 style, as activation
of items requires a double-click there.
Task-number: QTBUG-8138
Reviewed-by: Shane Kearns
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f4c7304..387762f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -364,6 +364,7 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) SetFocusing(true); m_longTapDetector = QLongTapTimer::NewL(this); + m_doubleClickTimer.invalidate(); DrawableWindow()->SetPointerGrab(ETrue); } @@ -642,6 +643,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod QPoint pos = QCursor::pos(); TPointerEvent fakeEvent; + fakeEvent.iModifiers = keyEvent.iModifiers; TInt x = pos.x(); TInt y = pos.y(); if (type == EEventKeyUp) { @@ -668,6 +670,8 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod } } else if (type == EEventKey) { + if (keyCode != Qt::Key_Select) + m_doubleClickTimer.invalidate(); switch (keyCode) { case Qt::Key_Left: S60->virtualMousePressedKeys |= QS60Data::Left; @@ -700,6 +704,13 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod } else { S60->virtualMousePressedKeys |= QS60Data::Select; fakeEvent.iType = TPointerEvent::EButton1Down; + if (m_doubleClickTimer.isValid() + && !m_doubleClickTimer.hasExpired(QApplication::doubleClickInterval())) { + fakeEvent.iModifiers |= EModifierDoubleClick; + m_doubleClickTimer.invalidate(); + } else { + m_doubleClickTimer.start(); + } } break; } @@ -715,7 +726,6 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod y = S60->screenHeightInPixels - 1; TPoint epos(x, y); TPoint cpos = epos - PositionRelativeToScreen(); - fakeEvent.iModifiers = keyEvent.iModifiers; fakeEvent.iPosition = cpos; fakeEvent.iParentPosition = epos; HandlePointerEvent(fakeEvent); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 58da302..1af8eeb 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -62,6 +62,7 @@ #include "QtGui/qevent.h" #include "qpointer.h" #include "qapplication.h" +#include "qelapsedtimer.h" #include <w32std.h> #include <coecntrl.h> #include <eikenv.h> @@ -222,6 +223,7 @@ private: private: QWidget *qwidget; QLongTapTimer* m_longTapDetector; + QElapsedTimer m_doubleClickTimer; bool m_ignoreFocusChanged : 1; bool m_symbianPopupIsOpen : 1; |