diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-06-16 09:45:30 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-06-16 09:55:51 (GMT) |
commit | 9d78e1132427ec803f08b2861ab27587ca72cfbf (patch) | |
tree | 181989d7442cd81fd975ae8d3f45aa184f4804cb /src/gui/widgets/qmainwindow.cpp | |
parent | 18fcfc3576b7bcbcf3326697461f21fab990512b (diff) | |
download | Qt-9d78e1132427ec803f08b2861ab27587ca72cfbf.zip Qt-9d78e1132427ec803f08b2861ab27587ca72cfbf.tar.gz Qt-9d78e1132427ec803f08b2861ab27587ca72cfbf.tar.bz2 |
Update softkeys correctly when no focus widget is present.
In the case where there is no focus widget present, the button group
container should be updated with the softkeys from the currently active
window if it has softkeys. This patch enables this behavior.
Also modify QMainWindow such that the soft keys are updated when the
main window becomes the active window and not only when the menu bar
is set. At the moment, this creates a new QAction and this should be
changed since it will continuously grow the memory.
As a final fix, move the soft key setting out of setFocus() because it
is much to early. At the point, the widget does not know for certain
that it actually will get focus since it could be disabled or have a
focus proxy.
Diffstat (limited to 'src/gui/widgets/qmainwindow.cpp')
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 2f3b412..5f8371c 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1396,7 +1396,16 @@ bool QMainWindow::event(QEvent *event) } break; #endif - +#ifndef QT_NO_MENUBAR + case QEvent::WindowActivate: + if (d->layout->menuBar()) { + // ### TODO: This is evil, there is no need to create a new action every time + QAction* menu = new QAction(QString::fromLatin1("Menu"), this); + menu->setSoftKeyRole(QAction::MenuSoftKey); + setSoftKey(menu); + } + break; +#endif default: break; } |