summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindow.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-16 09:45:30 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-06-16 09:55:51 (GMT)
commit9d78e1132427ec803f08b2861ab27587ca72cfbf (patch)
tree181989d7442cd81fd975ae8d3f45aa184f4804cb /src/gui/widgets/qmainwindow.cpp
parent18fcfc3576b7bcbcf3326697461f21fab990512b (diff)
downloadQt-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.cpp11
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;
}