diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-06-08 08:33:38 (GMT) |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-06-08 08:33:38 (GMT) |
commit | 8938f242414cc67f8a4081222857bfeb16bb5f37 (patch) | |
tree | 5dafd79edc9d164ab1002896c90647bf373a8727 /src | |
parent | 5d749ad1b67a8d5ba77800567ffa473f5ad1d9f5 (diff) | |
download | Qt-8938f242414cc67f8a4081222857bfeb16bb5f37.zip Qt-8938f242414cc67f8a4081222857bfeb16bb5f37.tar.gz Qt-8938f242414cc67f8a4081222857bfeb16bb5f37.tar.bz2 |
Implemented context sensitive menu item
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index e422882..ed2ea46 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -90,6 +90,16 @@ bool menuExists() return true; } +static bool hasContextMenu(QWidget* widget) +{ + if (!widget) + return false; + const Qt::ContextMenuPolicy policy = widget->contextMenuPolicy(); + if (policy != Qt::NoContextMenu && policy != Qt::PreventContextMenu ) { + return true; + } + return false; +} // ### FIX THIS, copy/paste of original (faulty) stripped text implementation. // Implementation should be removed from QAction implementation to some generic place static QString qt_strippedText_copy_from_qaction(QString s) @@ -212,24 +222,12 @@ static void rebuildMenu() QMenuBarPrivate *mb = 0; QWidget *w = qApp->activeWindow(); QMainWindow *mainWindow = qobject_cast<QMainWindow*>(w); - /* if ((mainWindow) && mainWindow->hasSoftKeyStack()) { - QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); - if (!softKeyStack->isEmpty()) { - const QSoftkeySet& softKeyTop = softKeyStack->top(); - int index=0; - bool found=false; - while( index<softKeyTop.count() && !found) { - QSoftKeyAction* softAction = softKeyTop.at(index); - QSoftKeyAction::StandardRole role = softAction->role(); - if(softAction->role() == QSoftKeyAction::ContextMenu) { - widgetWithContextMenu = softAction->parentWidget(); - found=true; - } - index++; - } - } + QWidget* focusWidget = QApplication::focusWidget(); + if (focusWidget) { + if (hasContextMenu(focusWidget)) + widgetWithContextMenu = focusWidget; } -*/ + if (w) { mb = menubars()->value(w); qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; |