From 1cf0b9e36eaab3bf593509260e8a2de0c85548bb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 25 Feb 2010 10:49:35 +0200 Subject: Misc fixes to FLM files 1) FLMs should not have more than one phase dependency -> removed extra dependencies, leaving only what is actually necessary. 2) -include $(FLMHOME)/metaflm.mk statements vere removed as obsolete 3) Added FORCESUCCESS to startrule call in qmake_extra_pre_targetdep.flm so that unrelated components can continue building instead of halting the whole build at EXPORT phase. 4) Added .export to qmake_extra_pre_targetdep interface so that it is actually executed in EXPORT phase where it should be. Task-number: QTBUG-8513 Reviewed-by: Janne Koskinen --- mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm | 2 -- mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm | 8 ++------ mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm | 2 -- mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm | 3 +-- mkspecs/symbian-sbsv2/flm/qt/qt.xml | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm index 3defe30..3877edb 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm @@ -7,14 +7,12 @@ # ** # ****************************************************************************/ -include $(FLMHOME)/metaflm.mk SINGLETON:=$(call sanitise,TARGET_$(DEPLOY_TARGET)) CLEAN_TARGET:= define qmake_emulator_deployment $(ALLTARGET):: $(1) -FINAL::$(1) # Prevent duplicate targets from being created $(SINGLETON):=1 diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm index 79ab8cb..daf33d4 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm @@ -7,21 +7,17 @@ # ** # ****************************************************************************/ -include $(FLMHOME)/metaflm.mk SINGLETON:=$(call sanitise,TARGET_$(PREDEP_TARGET)) define qmake_extra_pre_targetdep -$(ALLTARGET):: $(PREDEP_TARGET) EXPORT:: $(PREDEP_TARGET) -LIBRARY:: $(PREDEP_TARGET) -TARGET:: $(PREDEP_TARGET) # Prevent duplicate targets from being created $(SINGLETON):=1 -$(PREDEP_TARGET): $(DEPS) - $(call startrule,qmake_extra_pre_targetdep) \ +$(PREDEP_TARGET): $(DEPS) + $(call startrule,qmake_extra_pre_targetdep,FORCESUCCESS) \ $(COMMAND) \ $(call endrule,qmake_extra_pre_targetdep) endef diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm index 8ad89e7..9612d2e 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm @@ -7,7 +7,6 @@ # ** # ****************************************************************************/ -include $(FLMHOME)/metaflm.mk POST_LINK_TARGET:=POST_LINK_$(PLATFORM_PATH)_$(CFG_PATH)_$(call sanitise,$(LINK_TARGET)) POST_LINK_DEP:=$(EPOCROOT)/epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/$(LINK_TARGET) @@ -21,7 +20,6 @@ endef define qmake_post_link $(ALLTARGET):: $(POST_LINK_TARGET) -FINAL:: $(POST_LINK_TARGET) $(POST_LINK_TARGET): $(POST_LINK_DEP) $(call startrule,qmake_post_link) \ diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm index d952f8f..e0b6503 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -7,7 +7,6 @@ # ** # ****************************************************************************/ -include $(FLMHOME)/metaflm.mk SINGLETON:=$(call sanitise,TSTORE_SINGLETON_$(EXTENSION_ROOT)) @@ -27,7 +26,7 @@ VISUAL_CFG:=RELEASE endif define qmake_store_build -FINAL:: $(STORE_BUILD_TARGET) +$(ALLTARGET):: $(STORE_BUILD_TARGET) $(STORE_BUILD_TARGET): $(call startrule,qmake_store_build) \ diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 904f113..0f7db3c 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -16,7 +16,7 @@ - diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 3eb3059..8289f7f 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -362,7 +362,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t } } - t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl; + t << "START EXTENSION qt/qmake_extra_pre_targetdep.export" << endl; t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; t << "OPTION DEPS " << absoluteDeps << endl; -- cgit v0.12 From 68c909373d96f61f1a06cfb486df320e56b2e75a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 25 Feb 2010 12:04:58 +0200 Subject: Fix SymbianMakefileGenerator::absolutizePath for clean builds QFileInfo::isDir() will not return correct value if path doesn't exist like it doesn't in case of clean builds. Turned the check around and used isFile() instead. If a file is given as origPath, it is assumed to exist, because it was explicitly given with HEADERS variable and qmake will give warning if nonexisted file is given there. Reviewed-by: Janne Koskinen --- qmake/generators/symbian/symmake.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index a7eca54..ee579bb 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -147,10 +147,14 @@ QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); QFileInfo fi(fileInfo(resultPath)); - if (fi.isDir()) { - resultPath = fi.absoluteFilePath(); - } else { + + // Since origPath can be something given in HEADERS, we need to check if we are dealing + // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns + // false and we default to assuming it is a dir. + if (fi.isFile()) { resultPath = fi.absolutePath(); + } else { + resultPath = fi.absoluteFilePath(); } resultPath = QDir::cleanPath(resultPath); -- cgit v0.12 From d8465414e6fd543cfc20e732030dedd8d2bc685f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 25 Feb 2010 11:28:47 +0200 Subject: Improvements to itemview keypad navigation in S60. The logic used in this commit is partially taken from sliders. This commit makes it possible to interact (change row or column) in itemview even itemview does not have editFocus. Interacting without editFocus is enabled when it is not possible to keypad navigate to reuqested direction. In addition if keypad navigation to any direction is not possible (i.e there is only one listwidget on screen), there is no sense to add "done" softkey to get out of edit focus. Task-number: QTBUG-4802 Reviewed-by: Alessandro Portale --- demos/embedded/desktopservices/contenttab.cpp | 14 ------- src/gui/itemviews/qabstractitemview.cpp | 41 +++++++++++++++++++-- src/gui/kernel/qwidget.cpp | 43 ++++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 2 + src/gui/widgets/qabstractslider.cpp | 53 ++++----------------------- 5 files changed, 89 insertions(+), 64 deletions(-) diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index 8714b9c..fa9c586 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -114,20 +114,6 @@ QUrl ContentTab::itemUrl(QListWidgetItem *item) void ContentTab::keyPressEvent(QKeyEvent *event) { switch (event->key()) { - case Qt::Key_Up: - if (currentRow() == 0) { - setCurrentRow(count() - 1); - } else { - setCurrentRow(currentRow() - 1); - } - break; - case Qt::Key_Down: - if (currentRow() == (count() - 1)) { - setCurrentRow(0); - } else { - setCurrentRow(currentRow() + 1); - } - break; case Qt::Key_Select: openItem(currentItem()); default: diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index adf3ce3..555555e 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2119,6 +2119,11 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event) Q_D(QAbstractItemView); QAbstractScrollArea::focusOutEvent(event); d->viewport->update(); + +#ifdef QT_SOFTKEYS_ENABLED + if(!hasEditFocus()) + removeAction(d->doneSoftKey); +#endif } /*! @@ -2144,7 +2149,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) if (!hasEditFocus()) { setEditFocus(true); #ifdef QT_SOFTKEYS_ENABLED - addAction(d->doneSoftKey); + // If we can't keypad navigate to any direction, there is no sense to add + // "Done" softkey, since it basically does nothing when there is + // only one widget in screen + if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) + addAction(d->doneSoftKey); #endif return; } @@ -2160,6 +2170,26 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) event->ignore(); } return; + case Qt::Key_Down: + case Qt::Key_Up: + // Let's ignore vertical navigation events, only if there is no other widget + // what can take the focus in vertical direction. This means widget can handle navigation events + // even the widget don't have edit focus, and there is no other widget in requested direction. + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { + event->ignore(); + return; + } + break; + case Qt::Key_Left: + case Qt::Key_Right: + // Similar logic as in up and down events + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { + event->ignore(); + return; + } + break; default: if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { event->ignore(); @@ -2245,7 +2275,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Down: case Qt::Key_Up: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { event->accept(); // don't change focus break; } @@ -2253,8 +2283,11 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Left: case Qt::Key_Right: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { - event->accept(); // don't change horizontal focus in directional mode + int colCount = d->model->columnCount(d->root); + if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || (QWidgetPrivate::inTabWidget(this) && colCount > 1))) { + event->accept(); // don't change focus break; } #endif // QT_KEYPAD_NAVIGATION diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 850e961..d3340df 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -118,6 +118,10 @@ #include "private/qgraphicssystem_p.h" #include "private/qgesturemanager_p.h" +#ifdef QT_KEYPAD_NAVIGATION +#include "qtabwidget.h" // Needed in inTabWidget() +#endif // QT_KEYPAD_NAVIGATION + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG //#define ALIEN_DEBUG @@ -11626,6 +11630,45 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) } return targetWidget; } + +/*! + \internal + + Tells us if it there is currently a reachable widget by keypad navigation in + a certain \a orientation. + If no navigation is possible, occuring key events in that \a orientation may + be used to interact with the value in the focussed widget, even though it + currently has not the editFocus. + + \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() +*/ +bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) +{ + return orientation == Qt::Horizontal? + (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) + :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); +} +/*! + \internal + + Checks, if the \a widget is inside a QTabWidget. If is is inside + one, left/right key events will be used to switch between tabs in keypad + navigation. If there is no QTabWidget, the horizontal key events can be used +to + interact with the value in the focussed widget, even though it currently has + not the editFocus. + + \sa QWidget::hasEditFocus() +*/ +bool QWidgetPrivate::inTabWidget(QWidget *widget) +{ + for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) + if (qobject_cast(tabWidget)) + return true; + return false; +} #endif /*! diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index b421d30..1cb6072 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -472,6 +472,8 @@ public: #ifdef QT_KEYPAD_NAVIGATION static bool navigateToDirection(Direction direction); static QWidget *widgetInNavigationDirection(Direction direction); + static inline bool canKeypadNavigate(Qt::Orientation orientation); + static inline bool inTabWidget(QWidget *widget); #endif void setWindowIconText_sys(const QString &cap); diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 4bd7b5a..2888490 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -47,9 +47,6 @@ #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif -#ifdef QT_KEYPAD_NAVIGATION -#include "qtabwidget.h" // Needed in inTabWidget() -#endif // QT_KEYPAD_NAVIGATION #include QT_BEGIN_NAMESPACE @@ -702,7 +699,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb stepsToScroll = qBound(-pageStep, int(offset * pageStep), pageStep); offset_accumulated = 0; } else { - // Calculate how many lines to scroll. Depending on what delta is (and + // Calculate how many lines to scroll. Depending on what delta is (and // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. qreal stepsToScrollF = @@ -749,45 +746,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) } #endif -#ifdef QT_KEYPAD_NAVIGATION -/*! - \internal - - Tells us if it there is currently a reachable widget by keypad navigation in - a certain \a orientation. - If no navigation is possible, occuring key events in that \a orientation may - be used to interact with the value in the focussed widget, even though it - currently has not the editFocus. - \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() -*/ -inline static bool canKeypadNavigate(Qt::Orientation orientation) -{ - return orientation == Qt::Horizontal? - (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) - || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) - :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) - || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); -} -/*! - \internal - - Checks, if the \a widget is inside a QTabWidget. If is is inside - one, left/right key events will be used to switch between tabs in keypad - navigation. If there is no QTabWidget, the horizontal key events can be used to - interact with the value in the focussed widget, even though it currently has - not the editFocus. - - \sa QWidget::hasEditFocus() -*/ -inline static bool inTabWidget(QWidget *widget) -{ - for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) - if (qobject_cast(tabWidget)) - return true; - return false; -} -#endif // QT_KEYPAD_NAVIGATION /*! \reimp */ @@ -853,7 +812,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Vertical - || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { + || !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) { ev->ignore(); return; } @@ -872,7 +832,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Vertical - || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { + || !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) { ev->ignore(); return; } @@ -892,7 +853,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Horizontal - || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { + || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } @@ -905,7 +866,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Horizontal - || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { + || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } -- cgit v0.12 From d996f6707a8733a8d151dcad59981cbb0f2f03f1 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 25 Feb 2010 17:06:32 +0200 Subject: Crash in QGraphicsScenePrivate::setFocusItemHelper QGraphicsScenePrivate::setFocusItemHelper accesses views.at(i)->inputContext() without checking if it is null. This leads to a crash if it really is null. Fixed by adding a null pointer check. Task-number: QT-3008 Reviewed-by: axis --- src/gui/graphicsview/qgraphicsscene.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 4472272..1cd1dba 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -801,7 +801,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, // do it ourselves. if (item) { for (int i = 0; i < views.size(); ++i) - views.at(i)->inputContext()->reset(); + if (views.at(i)->inputContext()) + views.at(i)->inputContext()->reset(); } } #endif //QT_NO_IM -- cgit v0.12 From 133f853e569494303fc432f6c6009dd44c504446 Mon Sep 17 00:00:00 2001 From: wasila Date: Thu, 25 Feb 2010 16:14:37 +0100 Subject: Enabled Qt key events to work also when native key code is missing. If it is missing we base the event on the scan code instead. RevBy: Alessandro Portale Signed-off-by: axis --- src/gui/kernel/qapplication_s60.cpp | 4 +- src/gui/kernel/qkeymapper_p.h | 16 +- src/gui/kernel/qkeymapper_s60.cpp | 285 ++++++++++++++++-------------------- 3 files changed, 141 insertions(+), 164 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fdbbeb2..2eecd56 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -597,7 +597,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, keyEvent.iCode); int keyCode; - if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { + if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used + keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); + } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { // Normal characters keys. keyCode = s60Keysym; } else { diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 09c36c88..706ee23 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -137,12 +137,21 @@ struct QXCoreDesc { KeySym lock_meaning; }; +#elif defined(Q_OS_SYMBIAN) +#include +class KeyMapping{ +public: + KeyMapping(TKeyCode aS60KeyCode, TStdScanCode aS60ScanCode, Qt::Key aQtKey) : s60KeyCode(aS60KeyCode), s60ScanCode(aS60ScanCode), qtKey(aQtKey) { }; + TKeyCode s60KeyCode; + TStdScanCode s60ScanCode; + Qt::Key qtKey; +}; #endif struct KeyboardLayoutItem; typedef struct __TISInputSource * TISInputSourceRef; class QKeyEvent; -class QKeyMapperPrivate : public QObjectPrivate +class Q_GUI_EXPORT QKeyMapperPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QKeyMapper) public: @@ -208,11 +217,14 @@ public: #elif defined(Q_WS_QWS) #elif defined(Q_OS_SYMBIAN) private: - QHash s60ToQtKeyMap; + QList keyMapping; void fillKeyMap(); public: QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers); int mapS60KeyToQt(TUint s60key); + int mapS60ScanCodesToQt(TUint s60key); + int mapQtToS60Key(int qtKey); + int mapQtToS60ScanCodes(int qtKey); #endif }; diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index 6e21420..039be14 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -77,171 +77,134 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers / void QKeyMapperPrivate::fillKeyMap() { using namespace Qt; - static const struct { - TUint s60Key; - int qtKey; - } map[] = { - {EKeyBell, Key_unknown}, - {EKeyBackspace, Key_Backspace}, - {EKeyTab, Key_Tab}, - {EKeyLineFeed, Key_unknown}, - {EKeyVerticalTab, Key_unknown}, - {EKeyFormFeed, Key_unknown}, - {EKeyEnter, Key_Enter}, - {EKeyEscape, Key_Escape}, - {EKeySpace, Key_Space}, - {EKeyDelete, Key_Delete}, - {EKeyPrintScreen, Key_SysReq}, - {EKeyPause, Key_Pause}, - {EKeyHome, Key_Home}, - {EKeyEnd, Key_End}, - {EKeyPageUp, Key_PageUp}, - {EKeyPageDown, Key_PageDown}, - {EKeyInsert, Key_Insert}, - {EKeyLeftArrow, Key_Left}, - {EKeyRightArrow, Key_Right}, - {EKeyUpArrow, Key_Up}, - {EKeyDownArrow, Key_Down}, - {EKeyLeftShift, Key_Shift}, - {EKeyRightShift, Key_Shift}, - {EKeyLeftAlt, Key_Alt}, - {EKeyRightAlt, Key_AltGr}, - {EKeyLeftCtrl, Key_Control}, - {EKeyRightCtrl, Key_Control}, - {EKeyLeftFunc, Key_Super_L}, - {EKeyRightFunc, Key_Super_R}, - {EKeyCapsLock, Key_CapsLock}, - {EKeyNumLock, Key_NumLock}, - {EKeyScrollLock, Key_ScrollLock}, - {EKeyF1, Key_F1}, - {EKeyF2, Key_F2}, - {EKeyF3, Key_F3}, - {EKeyF4, Key_F4}, - {EKeyF5, Key_F5}, - {EKeyF6, Key_F6}, - {EKeyF7, Key_F7}, - {EKeyF8, Key_F8}, - {EKeyF9, Key_F9}, - {EKeyF10, Key_F10}, - {EKeyF11, Key_F11}, - {EKeyF12, Key_F12}, - {EKeyF13, Key_F13}, - {EKeyF14, Key_F14}, - {EKeyF15, Key_F15}, - {EKeyF16, Key_F16}, - {EKeyF17, Key_F17}, - {EKeyF18, Key_F18}, - {EKeyF19, Key_F19}, - {EKeyF20, Key_F20}, - {EKeyF21, Key_F21}, - {EKeyF22, Key_F22}, - {EKeyF23, Key_F23}, - {EKeyF24, Key_F24}, - {EKeyOff, Key_unknown}, - {EKeyIncContrast, Key_unknown}, - {EKeyDecContrast, Key_unknown}, - {EKeyBacklightOn, Key_unknown}, - {EKeyBacklightOff, Key_unknown}, - {EKeyBacklightToggle, Key_unknown}, - {EKeySliderDown, Key_unknown}, - {EKeySliderUp, Key_unknown}, - {EKeyMenu, Key_Menu}, - {EKeyDictaphonePlay, Key_unknown}, - {EKeyDictaphoneStop, Key_unknown}, - {EKeyDictaphoneRecord, Key_unknown}, - {EKeyHelp, Key_unknown}, - {EKeyDial, Key_Call}, - {EKeyScreenDimension0, Key_unknown}, - {EKeyScreenDimension1, Key_unknown}, - {EKeyScreenDimension2, Key_unknown}, - {EKeyScreenDimension3, Key_unknown}, - {EKeyIncVolume, Key_unknown}, - {EKeyDecVolume, Key_unknown}, - {EKeyDevice0, Key_Context1}, // Found by manual testing, left softkey. - {EKeyDevice1, Key_Context2}, // Found by manual testing. - {EKeyDevice2, Key_unknown}, - {EKeyDevice3, Key_Select}, // Found by manual testing. - {EKeyDevice4, Key_unknown}, - {EKeyDevice5, Key_unknown}, - {EKeyDevice6, Key_unknown}, - {EKeyDevice7, Key_unknown}, - {EKeyDevice8, Key_unknown}, - {EKeyDevice9, Key_unknown}, - {EKeyDeviceA, Key_unknown}, - {EKeyDeviceB, Key_unknown}, - {EKeyDeviceC, Key_unknown}, - {EKeyDeviceD, Key_unknown}, - {EKeyDeviceE, Key_unknown}, - {EKeyDeviceF, Key_unknown}, - {EKeyApplication0, Key_Launch0}, - {EKeyApplication1, Key_Launch1}, - {EKeyApplication2, Key_Launch2}, - {EKeyApplication3, Key_Launch3}, - {EKeyApplication4, Key_Launch4}, - {EKeyApplication5, Key_Launch5}, - {EKeyApplication6, Key_Launch6}, - {EKeyApplication7, Key_Launch7}, - {EKeyApplication8, Key_Launch8}, - {EKeyApplication9, Key_Launch9}, - {EKeyApplicationA, Key_LaunchA}, - {EKeyApplicationB, Key_LaunchB}, - {EKeyApplicationC, Key_LaunchC}, - {EKeyApplicationD, Key_LaunchD}, - {EKeyApplicationE, Key_LaunchE}, - {EKeyApplicationF, Key_LaunchF}, - {EKeyYes, Key_Yes}, - {EKeyNo, Key_No}, - {EKeyIncBrightness, Key_unknown}, - {EKeyDecBrightness, Key_unknown}, - {EKeyKeyboardExtend, Key_unknown}, - {EKeyDevice10, Key_unknown}, - {EKeyDevice11, Key_unknown}, - {EKeyDevice12, Key_unknown}, - {EKeyDevice13, Key_unknown}, - {EKeyDevice14, Key_unknown}, - {EKeyDevice15, Key_unknown}, - {EKeyDevice16, Key_unknown}, - {EKeyDevice17, Key_unknown}, - {EKeyDevice18, Key_unknown}, - {EKeyDevice19, Key_unknown}, - {EKeyDevice1A, Key_unknown}, - {EKeyDevice1B, Key_unknown}, - {EKeyDevice1C, Key_unknown}, - {EKeyDevice1D, Key_unknown}, - {EKeyDevice1E, Key_unknown}, - {EKeyDevice1F, Key_unknown}, - {EKeyApplication10, Key_unknown}, - {EKeyApplication11, Key_unknown}, - {EKeyApplication12, Key_unknown}, - {EKeyApplication13, Key_unknown}, - {EKeyApplication14, Key_unknown}, - {EKeyApplication15, Key_unknown}, - {EKeyApplication16, Key_unknown}, - {EKeyApplication17, Key_unknown}, - {EKeyApplication18, Key_unknown}, - {EKeyApplication19, Key_unknown}, - {EKeyApplication1A, Key_unknown}, - {EKeyApplication1B, Key_unknown}, - {EKeyApplication1C, Key_unknown}, - {EKeyApplication1D, Key_unknown}, - {EKeyApplication1E, Key_unknown}, - {EKeyApplication1F, Key_unknown} - }; - const int mapSize = int(sizeof(map)/sizeof(map[0])); - s60ToQtKeyMap.reserve(mapSize + 5); // +5? docs: Ideally, slightly more than number of items - for (int i = 0; i < mapSize; ++i) - s60ToQtKeyMap.insert(map[i].s60Key, map[i].qtKey); + keyMapping.append(KeyMapping(EKeyBackspace, EStdKeyBackspace, Key_Backspace)); + keyMapping.append(KeyMapping(EKeyTab, EStdKeyTab, Key_Tab)); + keyMapping.append(KeyMapping(EKeyEnter, EStdKeyEnter, Key_Enter)); + keyMapping.append(KeyMapping(EKeyEscape, EStdKeyEscape, Key_Escape)); + keyMapping.append(KeyMapping(EKeySpace, EStdKeySpace, Key_Space)); + keyMapping.append(KeyMapping(EKeyDelete, EStdKeyDelete, Key_Delete)); + keyMapping.append(KeyMapping(EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq)); + keyMapping.append(KeyMapping(EKeyPause, EStdKeyPause, Key_Pause)); + keyMapping.append(KeyMapping(EKeyHome, EStdKeyHome, Key_Home)); + keyMapping.append(KeyMapping(EKeyEnd, EStdKeyEnd, Key_End)); + keyMapping.append(KeyMapping(EKeyPageUp, EStdKeyPageUp, Key_PageUp)); + keyMapping.append(KeyMapping(EKeyPageDown, EStdKeyPageDown, Key_PageDown)); + keyMapping.append(KeyMapping(EKeyInsert, EStdKeyInsert, Key_Insert)); + keyMapping.append(KeyMapping(EKeyLeftArrow, EStdKeyLeftArrow, Key_Left)); + keyMapping.append(KeyMapping(EKeyRightArrow, EStdKeyRightArrow, Key_Right)); + keyMapping.append(KeyMapping(EKeyUpArrow, EStdKeyUpArrow, Key_Up)); + keyMapping.append(KeyMapping(EKeyDownArrow, EStdKeyDownArrow, Key_Down)); + keyMapping.append(KeyMapping(EKeyLeftShift, EStdKeyLeftShift, Key_Shift)); + keyMapping.append(KeyMapping(EKeyRightShift, EStdKeyRightShift, Key_Shift)); + keyMapping.append(KeyMapping(EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt)); + keyMapping.append(KeyMapping(EKeyRightAlt, EStdKeyRightAlt, Key_AltGr)); + keyMapping.append(KeyMapping(EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control)); + keyMapping.append(KeyMapping(EKeyRightCtrl, EStdKeyRightCtrl, Key_Control)); + keyMapping.append(KeyMapping(EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L)); + keyMapping.append(KeyMapping(EKeyRightFunc, EStdKeyRightFunc, Key_Super_R)); + keyMapping.append(KeyMapping(EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock)); + keyMapping.append(KeyMapping(EKeyNumLock, EStdKeyNumLock, Key_NumLock)); + keyMapping.append(KeyMapping(EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock)); + keyMapping.append(KeyMapping(EKeyF1, EStdKeyF1, Key_F1)); + keyMapping.append(KeyMapping(EKeyF2, EStdKeyF2, Key_F2)); + keyMapping.append(KeyMapping(EKeyF3, EStdKeyF3, Key_F3)); + keyMapping.append(KeyMapping(EKeyF4, EStdKeyF4, Key_F4)); + keyMapping.append(KeyMapping(EKeyF5, EStdKeyF5, Key_F5)); + keyMapping.append(KeyMapping(EKeyF6, EStdKeyF6, Key_F6)); + keyMapping.append(KeyMapping(EKeyF7, EStdKeyF7, Key_F7)); + keyMapping.append(KeyMapping(EKeyF8, EStdKeyF8, Key_F8)); + keyMapping.append(KeyMapping(EKeyF9, EStdKeyF9, Key_F9)); + keyMapping.append(KeyMapping(EKeyF10, EStdKeyF10, Key_F10)); + keyMapping.append(KeyMapping(EKeyF11, EStdKeyF11, Key_F11)); + keyMapping.append(KeyMapping(EKeyF12, EStdKeyF12, Key_F12)); + keyMapping.append(KeyMapping(EKeyF13, EStdKeyF13, Key_F13)); + keyMapping.append(KeyMapping(EKeyF14, EStdKeyF14, Key_F14)); + keyMapping.append(KeyMapping(EKeyF15, EStdKeyF15, Key_F15)); + keyMapping.append(KeyMapping(EKeyF16, EStdKeyF16, Key_F16)); + keyMapping.append(KeyMapping(EKeyF17, EStdKeyF17, Key_F17)); + keyMapping.append(KeyMapping(EKeyF18, EStdKeyF18, Key_F18)); + keyMapping.append(KeyMapping(EKeyF19, EStdKeyF19, Key_F19)); + keyMapping.append(KeyMapping(EKeyF20, EStdKeyF20, Key_F20)); + keyMapping.append(KeyMapping(EKeyF21, EStdKeyF21, Key_F21)); + keyMapping.append(KeyMapping(EKeyF22, EStdKeyF22, Key_F22)); + keyMapping.append(KeyMapping(EKeyF23, EStdKeyF23, Key_F23)); + keyMapping.append(KeyMapping(EKeyF24, EStdKeyF24, Key_F24)); + keyMapping.append(KeyMapping(EKeyOff, EStdKeyOff, Key_PowerOff)); +// keyMapping.append(KeyMapping(EKeyMenu, EStdKeyMenu, Key_Menu)); // Menu is EKeyApplication0 + keyMapping.append(KeyMapping(EKeyHelp, EStdKeyHelp, Key_Help)); + keyMapping.append(KeyMapping(EKeyDial, EStdKeyDial, Key_Call)); + keyMapping.append(KeyMapping(EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp)); + keyMapping.append(KeyMapping(EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown)); + keyMapping.append(KeyMapping(EKeyDevice0, EStdKeyDevice0, Key_Context1)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyDevice1, EStdKeyDevice1, Key_Context2)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyDevice3, EStdKeyDevice3, Key_Select)); +// keyMapping.append(KeyMapping(EKeyDevice7, EStdKeyDevice7, Key_Camera)); //not supported by qt yet + keyMapping.append(KeyMapping(EKeyApplication0, EStdKeyApplication0, Key_Menu)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication1, EStdKeyApplication1, Key_Launch1)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication2, EStdKeyApplication2, Key_MediaPlay)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication3, EStdKeyApplication3, Key_MediaStop)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication4, EStdKeyApplication4, Key_MediaNext)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious)); // Found by manual testing. + keyMapping.append(KeyMapping(EKeyApplication6, EStdKeyApplication6, Key_Launch6)); + keyMapping.append(KeyMapping(EKeyApplication7, EStdKeyApplication7, Key_Launch7)); + keyMapping.append(KeyMapping(EKeyApplication8, EStdKeyApplication8, Key_Launch8)); + keyMapping.append(KeyMapping(EKeyApplication9, EStdKeyApplication9, Key_Launch9)); + keyMapping.append(KeyMapping(EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA)); + keyMapping.append(KeyMapping(EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB)); + keyMapping.append(KeyMapping(EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC)); + keyMapping.append(KeyMapping(EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD)); + keyMapping.append(KeyMapping(EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE)); + keyMapping.append(KeyMapping(EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF)); +// keyMapping.append(KeyMapping(EKeyApplication19, EStdKeyApplication19, Key_CameraFocus)); //not supported by qt yet + keyMapping.append(KeyMapping(EKeyYes, EStdKeyYes, Key_Yes)); + keyMapping.append(KeyMapping(EKeyNo, EStdKeyNo, Key_No)); } int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) { - QHash::const_iterator mapping; - mapping = s60ToQtKeyMap.find(s60key); - if (mapping != s60ToQtKeyMap.end()) { - return *mapping; - } else { - return Qt::Key_unknown; - } + int res = Qt::Key_unknown; + for ( int i = 0, size = keyMapping.count(); i Date: Thu, 25 Feb 2010 16:40:52 +0100 Subject: Reduced the code and memory footprint of the keymap. This was done by using a static const data structure instead of a list. RevBy: Alessandro Portale --- src/gui/kernel/qkeymapper_p.h | 12 -- src/gui/kernel/qkeymapper_s60.cpp | 241 ++++++++++++++++++++------------------ 2 files changed, 124 insertions(+), 129 deletions(-) diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 706ee23..4fbfff0 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -137,15 +137,6 @@ struct QXCoreDesc { KeySym lock_meaning; }; -#elif defined(Q_OS_SYMBIAN) -#include -class KeyMapping{ -public: - KeyMapping(TKeyCode aS60KeyCode, TStdScanCode aS60ScanCode, Qt::Key aQtKey) : s60KeyCode(aS60KeyCode), s60ScanCode(aS60ScanCode), qtKey(aQtKey) { }; - TKeyCode s60KeyCode; - TStdScanCode s60ScanCode; - Qt::Key qtKey; -}; #endif struct KeyboardLayoutItem; @@ -216,9 +207,6 @@ public: KeyboardLayoutItem *keyLayout[256]; #elif defined(Q_WS_QWS) #elif defined(Q_OS_SYMBIAN) -private: - QList keyMapping; - void fillKeyMap(); public: QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers); int mapS60KeyToQt(TUint s60key); diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index 039be14..fd263ef 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE QKeyMapperPrivate::QKeyMapperPrivate() { - fillKeyMap(); } QKeyMapperPrivate::~QKeyMapperPrivate() @@ -74,137 +73,145 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers / return QString(QChar(keySym)); } -void QKeyMapperPrivate::fillKeyMap() -{ - using namespace Qt; - keyMapping.append(KeyMapping(EKeyBackspace, EStdKeyBackspace, Key_Backspace)); - keyMapping.append(KeyMapping(EKeyTab, EStdKeyTab, Key_Tab)); - keyMapping.append(KeyMapping(EKeyEnter, EStdKeyEnter, Key_Enter)); - keyMapping.append(KeyMapping(EKeyEscape, EStdKeyEscape, Key_Escape)); - keyMapping.append(KeyMapping(EKeySpace, EStdKeySpace, Key_Space)); - keyMapping.append(KeyMapping(EKeyDelete, EStdKeyDelete, Key_Delete)); - keyMapping.append(KeyMapping(EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq)); - keyMapping.append(KeyMapping(EKeyPause, EStdKeyPause, Key_Pause)); - keyMapping.append(KeyMapping(EKeyHome, EStdKeyHome, Key_Home)); - keyMapping.append(KeyMapping(EKeyEnd, EStdKeyEnd, Key_End)); - keyMapping.append(KeyMapping(EKeyPageUp, EStdKeyPageUp, Key_PageUp)); - keyMapping.append(KeyMapping(EKeyPageDown, EStdKeyPageDown, Key_PageDown)); - keyMapping.append(KeyMapping(EKeyInsert, EStdKeyInsert, Key_Insert)); - keyMapping.append(KeyMapping(EKeyLeftArrow, EStdKeyLeftArrow, Key_Left)); - keyMapping.append(KeyMapping(EKeyRightArrow, EStdKeyRightArrow, Key_Right)); - keyMapping.append(KeyMapping(EKeyUpArrow, EStdKeyUpArrow, Key_Up)); - keyMapping.append(KeyMapping(EKeyDownArrow, EStdKeyDownArrow, Key_Down)); - keyMapping.append(KeyMapping(EKeyLeftShift, EStdKeyLeftShift, Key_Shift)); - keyMapping.append(KeyMapping(EKeyRightShift, EStdKeyRightShift, Key_Shift)); - keyMapping.append(KeyMapping(EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt)); - keyMapping.append(KeyMapping(EKeyRightAlt, EStdKeyRightAlt, Key_AltGr)); - keyMapping.append(KeyMapping(EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control)); - keyMapping.append(KeyMapping(EKeyRightCtrl, EStdKeyRightCtrl, Key_Control)); - keyMapping.append(KeyMapping(EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L)); - keyMapping.append(KeyMapping(EKeyRightFunc, EStdKeyRightFunc, Key_Super_R)); - keyMapping.append(KeyMapping(EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock)); - keyMapping.append(KeyMapping(EKeyNumLock, EStdKeyNumLock, Key_NumLock)); - keyMapping.append(KeyMapping(EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock)); - keyMapping.append(KeyMapping(EKeyF1, EStdKeyF1, Key_F1)); - keyMapping.append(KeyMapping(EKeyF2, EStdKeyF2, Key_F2)); - keyMapping.append(KeyMapping(EKeyF3, EStdKeyF3, Key_F3)); - keyMapping.append(KeyMapping(EKeyF4, EStdKeyF4, Key_F4)); - keyMapping.append(KeyMapping(EKeyF5, EStdKeyF5, Key_F5)); - keyMapping.append(KeyMapping(EKeyF6, EStdKeyF6, Key_F6)); - keyMapping.append(KeyMapping(EKeyF7, EStdKeyF7, Key_F7)); - keyMapping.append(KeyMapping(EKeyF8, EStdKeyF8, Key_F8)); - keyMapping.append(KeyMapping(EKeyF9, EStdKeyF9, Key_F9)); - keyMapping.append(KeyMapping(EKeyF10, EStdKeyF10, Key_F10)); - keyMapping.append(KeyMapping(EKeyF11, EStdKeyF11, Key_F11)); - keyMapping.append(KeyMapping(EKeyF12, EStdKeyF12, Key_F12)); - keyMapping.append(KeyMapping(EKeyF13, EStdKeyF13, Key_F13)); - keyMapping.append(KeyMapping(EKeyF14, EStdKeyF14, Key_F14)); - keyMapping.append(KeyMapping(EKeyF15, EStdKeyF15, Key_F15)); - keyMapping.append(KeyMapping(EKeyF16, EStdKeyF16, Key_F16)); - keyMapping.append(KeyMapping(EKeyF17, EStdKeyF17, Key_F17)); - keyMapping.append(KeyMapping(EKeyF18, EStdKeyF18, Key_F18)); - keyMapping.append(KeyMapping(EKeyF19, EStdKeyF19, Key_F19)); - keyMapping.append(KeyMapping(EKeyF20, EStdKeyF20, Key_F20)); - keyMapping.append(KeyMapping(EKeyF21, EStdKeyF21, Key_F21)); - keyMapping.append(KeyMapping(EKeyF22, EStdKeyF22, Key_F22)); - keyMapping.append(KeyMapping(EKeyF23, EStdKeyF23, Key_F23)); - keyMapping.append(KeyMapping(EKeyF24, EStdKeyF24, Key_F24)); - keyMapping.append(KeyMapping(EKeyOff, EStdKeyOff, Key_PowerOff)); -// keyMapping.append(KeyMapping(EKeyMenu, EStdKeyMenu, Key_Menu)); // Menu is EKeyApplication0 - keyMapping.append(KeyMapping(EKeyHelp, EStdKeyHelp, Key_Help)); - keyMapping.append(KeyMapping(EKeyDial, EStdKeyDial, Key_Call)); - keyMapping.append(KeyMapping(EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp)); - keyMapping.append(KeyMapping(EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown)); - keyMapping.append(KeyMapping(EKeyDevice0, EStdKeyDevice0, Key_Context1)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyDevice1, EStdKeyDevice1, Key_Context2)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyDevice3, EStdKeyDevice3, Key_Select)); -// keyMapping.append(KeyMapping(EKeyDevice7, EStdKeyDevice7, Key_Camera)); //not supported by qt yet - keyMapping.append(KeyMapping(EKeyApplication0, EStdKeyApplication0, Key_Menu)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication1, EStdKeyApplication1, Key_Launch1)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication2, EStdKeyApplication2, Key_MediaPlay)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication3, EStdKeyApplication3, Key_MediaStop)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication4, EStdKeyApplication4, Key_MediaNext)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious)); // Found by manual testing. - keyMapping.append(KeyMapping(EKeyApplication6, EStdKeyApplication6, Key_Launch6)); - keyMapping.append(KeyMapping(EKeyApplication7, EStdKeyApplication7, Key_Launch7)); - keyMapping.append(KeyMapping(EKeyApplication8, EStdKeyApplication8, Key_Launch8)); - keyMapping.append(KeyMapping(EKeyApplication9, EStdKeyApplication9, Key_Launch9)); - keyMapping.append(KeyMapping(EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA)); - keyMapping.append(KeyMapping(EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB)); - keyMapping.append(KeyMapping(EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC)); - keyMapping.append(KeyMapping(EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD)); - keyMapping.append(KeyMapping(EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE)); - keyMapping.append(KeyMapping(EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF)); -// keyMapping.append(KeyMapping(EKeyApplication19, EStdKeyApplication19, Key_CameraFocus)); //not supported by qt yet - keyMapping.append(KeyMapping(EKeyYes, EStdKeyYes, Key_Yes)); - keyMapping.append(KeyMapping(EKeyNo, EStdKeyNo, Key_No)); -} +#include +struct KeyMapping{ + TKeyCode s60KeyCode; + TStdScanCode s60ScanCode; + Qt::Key qtKey; +}; + +using namespace Qt; + +static const KeyMapping keyMapping[] = { + {EKeyBackspace, EStdKeyBackspace, Key_Backspace}, + {EKeyTab, EStdKeyTab, Key_Tab}, + {EKeyEnter, EStdKeyEnter, Key_Enter}, + {EKeyEscape, EStdKeyEscape, Key_Escape}, + {EKeySpace, EStdKeySpace, Key_Space}, + {EKeyDelete, EStdKeyDelete, Key_Delete}, + {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq}, + {EKeyPause, EStdKeyPause, Key_Pause}, + {EKeyHome, EStdKeyHome, Key_Home}, + {EKeyEnd, EStdKeyEnd, Key_End}, + {EKeyPageUp, EStdKeyPageUp, Key_PageUp}, + {EKeyPageDown, EStdKeyPageDown, Key_PageDown}, + {EKeyInsert, EStdKeyInsert, Key_Insert}, + {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left}, + {EKeyRightArrow, EStdKeyRightArrow, Key_Right}, + {EKeyUpArrow, EStdKeyUpArrow, Key_Up}, + {EKeyDownArrow, EStdKeyDownArrow, Key_Down}, + {EKeyLeftShift, EStdKeyLeftShift, Key_Shift}, + {EKeyRightShift, EStdKeyRightShift, Key_Shift}, + {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt}, + {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr}, + {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control}, + {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control}, + {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L}, + {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R}, + {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock}, + {EKeyNumLock, EStdKeyNumLock, Key_NumLock}, + {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock}, + {EKeyF1, EStdKeyF1, Key_F1}, + {EKeyF2, EStdKeyF2, Key_F2}, + {EKeyF3, EStdKeyF3, Key_F3}, + {EKeyF4, EStdKeyF4, Key_F4}, + {EKeyF5, EStdKeyF5, Key_F5}, + {EKeyF6, EStdKeyF6, Key_F6}, + {EKeyF7, EStdKeyF7, Key_F7}, + {EKeyF8, EStdKeyF8, Key_F8}, + {EKeyF9, EStdKeyF9, Key_F9}, + {EKeyF10, EStdKeyF10, Key_F10}, + {EKeyF11, EStdKeyF11, Key_F11}, + {EKeyF12, EStdKeyF12, Key_F12}, + {EKeyF13, EStdKeyF13, Key_F13}, + {EKeyF14, EStdKeyF14, Key_F14}, + {EKeyF15, EStdKeyF15, Key_F15}, + {EKeyF16, EStdKeyF16, Key_F16}, + {EKeyF17, EStdKeyF17, Key_F17}, + {EKeyF18, EStdKeyF18, Key_F18}, + {EKeyF19, EStdKeyF19, Key_F19}, + {EKeyF20, EStdKeyF20, Key_F20}, + {EKeyF21, EStdKeyF21, Key_F21}, + {EKeyF22, EStdKeyF22, Key_F22}, + {EKeyF23, EStdKeyF23, Key_F23}, + {EKeyF24, EStdKeyF24, Key_F24}, + {EKeyOff, EStdKeyOff, Key_PowerOff}, +// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0 + {EKeyHelp, EStdKeyHelp, Key_Help}, + {EKeyDial, EStdKeyDial, Key_Call}, + {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp}, + {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown}, + {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing. + {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing. + {EKeyDevice3, EStdKeyDevice3, Key_Select}, +// {EKeyDevice7, EStdKeyDevice7, Key_Camera}, //not supported by qt yet + {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing. + {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing. + {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing. + {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing. + {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing. + {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing. + {EKeyApplication6, EStdKeyApplication6, Key_Launch6}, + {EKeyApplication7, EStdKeyApplication7, Key_Launch7}, + {EKeyApplication8, EStdKeyApplication8, Key_Launch8}, + {EKeyApplication9, EStdKeyApplication9, Key_Launch9}, + {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA}, + {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB}, + {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC}, + {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD}, + {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE}, + {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF}, +// {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus}, //not supported by qt yet + {EKeyYes, EStdKeyYes, Key_Yes}, + {EKeyNo, EStdKeyNo, Key_No}, + {TKeyCode(0), TStdScanCode(0), Qt::Key(0)} +}; int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) { - int res = Qt::Key_unknown; - for ( int i = 0, size = keyMapping.count(); i Date: Thu, 25 Feb 2010 16:44:58 +0100 Subject: Removed an export that shouldn't be exported. --- src/gui/kernel/qkeymapper_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 4fbfff0..3e42d6e 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -142,7 +142,7 @@ struct QXCoreDesc { struct KeyboardLayoutItem; typedef struct __TISInputSource * TISInputSourceRef; class QKeyEvent; -class Q_GUI_EXPORT QKeyMapperPrivate : public QObjectPrivate +class QKeyMapperPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QKeyMapper) public: -- cgit v0.12