From d75b10cf969c4d3b068d84bc650a76efcadc1012 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Wed, 30 Mar 2011 12:41:24 +0300 Subject: Support for new softkey in Symbian^3 QSoftKeyManager maps the StandardSoftKey values to Symbian commands. This way the softkeys are using Symbian defined icons. Task-number: QT-4620 Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager.cpp | 31 +++++++++++++++++++++++++++++++ src/gui/kernel/qsoftkeymanager_common_p.h | 3 +++ src/gui/kernel/qsoftkeymanager_s60.cpp | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 1b26933..204efe9 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -50,6 +50,10 @@ #include "private/qsoftkeymanager_s60_p.h" #endif +#ifdef SYMBIAN_VERSION_SYMBIAN3 +#include "private/qt_s60_p.h" +#endif + #ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE @@ -101,6 +105,30 @@ QSoftKeyManager::QSoftKeyManager() : QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) { QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); +#ifdef SYMBIAN_VERSION_SYMBIAN3 + int key = 0; + switch (standardKey) { + case OkSoftKey: + key = EAknSoftkeyOk; + break; + case SelectSoftKey: + key = EAknSoftkeySelect; + break; + case DoneSoftKey: + key = EAknSoftkeyDone; + break; + case MenuSoftKey: + key = EAknSoftkeyOptions; + break; + case CancelSoftKey: + key = EAknSoftkeyCancel; + break; + default: + break; + }; + if (key != 0) + QSoftKeyManager::instance()->d_func()->softKeyCommandActions.insert(action, key); +#endif QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case MenuSoftKey: // FALL-THROUGH @@ -143,6 +171,9 @@ void QSoftKeyManager::cleanupHash(QObject *obj) Q_D(QSoftKeyManager); QAction *action = qobject_cast(obj); d->keyedActions.remove(action); +#ifdef SYMBIAN_VERSION_SYMBIAN3 + d->softKeyCommandActions.remove(action); +#endif } void QSoftKeyManager::sendKeyEvent() diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h index 27d8ee9..02ae697 100644 --- a/src/gui/kernel/qsoftkeymanager_common_p.h +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -72,6 +72,9 @@ protected: QMultiHash requestedSoftKeyActions; QWidget *initialSoftKeySource; bool pendingUpdate; +#ifdef SYMBIAN_VERSION_SYMBIAN3 + QHash softKeyCommandActions; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 09e2b5f..79ed91a 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -298,6 +298,10 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, QString text = softkeyText(*action); TPtrC nativeText = qt_QString2TPtrC(text); int command = S60_COMMAND_START + position; +#ifdef SYMBIAN_VERSION_SYMBIAN3 + if (softKeyCommandActions.contains(action)) + command = softKeyCommandActions.value(action); +#endif setNativeSoftkey(cba, position, command, nativeText); const bool dimmed = !action->isEnabled() && !QSoftKeyManager::isForceEnabledInSofkeys(action); cba.DimCommand(command, dimmed); -- cgit v0.12 From 7ad2dfdc8e812b115a78742aa95d796cea16665a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 31 Mar 2011 12:47:53 +0300 Subject: QS60Style: Support menu separator (pt.2) Additional fix for this task. Make the separator slightly less wide, since on some themes the menu background border might be transparent near the left and right borders. Task-number: QTBUG-10054 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index da1528e..3706033 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2641,7 +2641,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_ItemViewItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast(opt)) { if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - sz = QSize(menuItem->rect.width(), 1); + sz = QSize(menuItem->rect.width() - 2 * pixelMetric(PM_MenuHMargin) - 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 1); break; } } -- cgit v0.12 From 7da530eba0e53cf0c15e790a395442fc9daa41b0 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 31 Mar 2011 14:04:21 +0300 Subject: QS60Style: Regression in drawing dialog background Fix for QTBUG-16858 improved somewhat QComboBox menu drawing, but unfortunately caused regression in QMenu and dialog background drawing. These widgets shouldn't reserve space for PM_MenuVMargin. Task-number: QTBUG-18482 Reviewed-by: Dmitry Trofimov --- src/gui/styles/qs60style.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3706033..05243a7 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2282,8 +2282,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti //Need extra check since dialogs have their own theme background if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) { + const bool comboMenu = qobject_cast(widget); // Add margin area to the background, to avoid background being cut for first and last item. - const int verticalMenuAdjustment = QS60StylePrivate::pixelMetric(PM_MenuVMargin); + const int verticalMenuAdjustment = comboMenu ? QS60StylePrivate::pixelMetric(PM_MenuVMargin) : 0; const QRect adjustedMenuRect = option->rect.adjusted(0, -verticalMenuAdjustment, 0, verticalMenuAdjustment); QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags); } else { -- cgit v0.12 From 54601b563fb1935c901fc99046ca35dd6d90d1c7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 31 Mar 2011 15:49:46 +0300 Subject: Do not set focus unnecessarily at window activation in Symbian Calling QSymbianControl::setFocusSafely(true) on currently focused window causes the next window in stack to get the focus momentarily, leading to various softkey problems, such as leaving child window's softkeys around when child is closed and flickering softkeys when child is opened. Added a check to QWidget::activateWindow to avoid calling setFocusSafely for already focused windows. Task-number: QTBUG-18409 Reviewed-by: Sami Merila Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index e7d5e95..8b57701 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1451,7 +1451,8 @@ void QWidget::activateWindow() if (tlw->isVisible()) { window()->createWinId(); QSymbianControl *id = static_cast(tlw->internalWinId()); - id->setFocusSafely(true); + if (!id->IsFocused()) + id->setFocusSafely(true); } } -- cgit v0.12