diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-05-29 14:40:27 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-05-29 14:40:27 (GMT) |
commit | 42fbf668b6da3251aea2ce27a25882437b9a4a06 (patch) | |
tree | ac8f2539e3bac665c25df0135b278edb81fe450f /src | |
parent | 8506cc8ce89c23fbfe27f9fb4d4e0cd7c90e9b24 (diff) | |
download | Qt-42fbf668b6da3251aea2ce27a25882437b9a4a06.zip Qt-42fbf668b6da3251aea2ce27a25882437b9a4a06.tar.gz Qt-42fbf668b6da3251aea2ce27a25882437b9a4a06.tar.bz2 |
Pulled helper menuActionList() out of QSoftKeyStack::handleFocusChanged.
It is also needed in other places.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qsoftkeystack.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/gui/widgets/qsoftkeystack.cpp b/src/gui/widgets/qsoftkeystack.cpp index 984922e..c07dd9e 100644 --- a/src/gui/widgets/qsoftkeystack.cpp +++ b/src/gui/widgets/qsoftkeystack.cpp @@ -177,6 +177,21 @@ bool QSoftKeyStack::isEmpty() return d->isEmpty(); } +QList<QSoftKeyAction*> menuActionList(QWidget *widget) +{ + QList<QSoftKeyAction*> result; + + QSoftKeyAction* menu = new QSoftKeyAction(QSoftKeyAction::Menu, QString::fromLatin1("Menu"), widget); + result.append(menu); + const Qt::ContextMenuPolicy policy = widget->contextMenuPolicy(); + if (policy != Qt::NoContextMenu && policy != Qt::PreventContextMenu ) { + QSoftKeyAction* contextMenu = new QSoftKeyAction(QSoftKeyAction::ContextMenu, QString::fromLatin1("ContextMenu"), widget); + result.append(contextMenu); + } + + return result; +} + void QSoftKeyStack::handleFocusChanged(QWidget *old, QWidget *now) { if (!now) @@ -188,17 +203,8 @@ void QSoftKeyStack::handleFocusChanged(QWidget *old, QWidget *now) if (!mainWindow->hasSoftKeyStack()) return; QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); - if( mainWindow->menuWidget() ) - { - QList<QSoftKeyAction*> actionList; - QSoftKeyAction* menu = new QSoftKeyAction(QSoftKeyAction::Menu, QString::fromLatin1("Menu"), now); - actionList.append(menu); - - Qt::ContextMenuPolicy policy = now->contextMenuPolicy(); - if (policy != Qt::NoContextMenu && policy != Qt::PreventContextMenu ) { - QSoftKeyAction* contextMenu = new QSoftKeyAction(QSoftKeyAction::ContextMenu, QString::fromLatin1("ContextMenu"), now); - actionList.append(contextMenu); - } + if (mainWindow->menuWidget()) { + QList<QSoftKeyAction*> actionList = menuActionList(now); if (old) softKeyStack->popandPush(actionList); else |