Commit b4245ac1 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

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
parent 52915776
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment