summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu.cpp
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2010-02-17 11:04:07 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2010-02-17 11:10:04 (GMT)
commit729d67cb35830a812c8c41a02a7b16a077dc14fb (patch)
tree67d65ea6a84dd2b3708d933878593341ab310880 /src/gui/widgets/qmenu.cpp
parent10b4dee4b0e196646e0bb4aab37dae6eaca8326e (diff)
downloadQt-729d67cb35830a812c8c41a02a7b16a077dc14fb.zip
Qt-729d67cb35830a812c8c41a02a7b16a077dc14fb.tar.gz
Qt-729d67cb35830a812c8c41a02a7b16a077dc14fb.tar.bz2
Support for dynamic localization in Symbian softkeys.
This commit adds support for dynamic i.e. runtime localization of S60 softkeys. Note that translations are not provided yet with qt.sis (QTBUG-4919), meaning that localization does not actually happen unless application developer provides its own translation (including translation for softkeys). Task-number: QTBUG-6785 Reviewed-by: Jason Barron
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r--src/gui/widgets/qmenu.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 8ce7cc0..42b7406 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -117,7 +117,7 @@ public:
if (parentWidget->parentWidget())
parentWidget = parentWidget->parentWidget();
setParent(parentWidget, Qt::Window | Qt::Tool);
- setAttribute(Qt::WA_DeleteOnClose, true);
+ setAttribute(Qt::WA_DeleteOnClose, true);
setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
setWindowTitle(p->windowTitle());
setEnabled(p->isEnabled());
@@ -1226,7 +1226,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
else if (action->isSeparator())
option->menuItemType = QStyleOptionMenuItem::Separator;
else if (d->defaultAction == action)
- option->menuItemType = QStyleOptionMenuItem::DefaultItem;
+ option->menuItemType = QStyleOptionMenuItem::DefaultItem;
else
option->menuItemType = QStyleOptionMenuItem::Normal;
if (action->isIconVisibleInMenu())
@@ -1719,7 +1719,14 @@ bool QMenu::isEmpty() const
void QMenu::clear()
{
QList<QAction*> acts = actions();
+
for(int i = 0; i < acts.size(); i++) {
+#ifdef QT_SOFTKEYS_ENABLED
+ Q_D(QMenu);
+ // Lets not touch to our internal softkey actions
+ if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
+ continue;
+#endif
removeAction(acts[i]);
if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
delete acts[i];
@@ -2408,6 +2415,13 @@ QMenu::event(QEvent *e)
}
return true;
#endif
+#ifdef QT_SOFTKEYS_ENABLED
+ case QEvent::LanguageChange: {
+ d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
+ d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
+ }
+ break;
+#endif
default:
break;
}
@@ -2919,7 +2933,7 @@ void QMenu::actionEvent(QActionEvent *e)
#endif
if (isVisible()) {
d->updateActionRects();
- resize(sizeHint());
+ resize(sizeHint());
update();
}
}