Prevent changing the context object just because the menu is activated

Fixes slowness when switching menus and allows menu actions to be used
that have a context that depends on the currently focused object.

Reviewed-by: con
This commit is contained in:
Thorbjørn Lindeijer
2009-04-22 17:36:32 +02:00
parent 52915776cd
commit b4245ac15c

View File

@@ -1028,9 +1028,13 @@ void MainWindow::changeEvent(QEvent *e)
void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
{
Q_UNUSED(old)
Q_UNUSED(now)
// Prevent changing the context object just because the menu is activated
if (qobject_cast<QMenuBar*>(now))
return;
IContext *newContext = 0;
if (focusWidget()) {
if (focusWidget()) {
IContext *context = 0;
QWidget *p = focusWidget();
while (p) {
@@ -1045,7 +1049,7 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
updateContextObject(newContext);
}
void MainWindow::updateContextObject(IContext *context)
void MainWindow::updateContextObject(IContext *context)
{
if (context == m_activeContext)
return;