Skip to content

Commit 8288deb

Browse files
committed
Don't open non-modal dialog from a modal symbol selector dialog
1 parent 3b64c34 commit 8288deb

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/app/qgsappwindowmanager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************
2-
qgswindowmanagerinterface.cpp
3-
-----------------------------
2+
qgsappwindowmanager.cpp
3+
-----------------------
44
Date : September 2018
55
Copyright : (C) 2018 Nyall Dawson
66
Email : nyall dot dawson at gmail dot com
@@ -59,8 +59,8 @@ QWidget *QgsAppWindowManager::openApplicationDialog( QgsAppWindowManager::Applic
5959
}
6060
mLayoutManagerDialog->show();
6161
mLayoutManagerDialog->activate();
62+
return mLayoutManagerDialog;
6263
}
63-
return nullptr;
6464
}
6565
return nullptr;
6666
}

src/app/qgsappwindowmanager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************
2-
qgswindowmanagerinterface.h
3-
---------------------------
2+
qgsappwindowmanager.h
3+
---------------------
44
Date : September 2018
55
Copyright : (C) 2018 Nyall Dawson
66
Email : nyall dot dawson at gmail dot com

src/gui/symbology/qgssymbolslistwidget.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,14 @@ void QgsSymbolsListWidget::updateModelFilters()
397397
void QgsSymbolsListWidget::openStyleManager()
398398
{
399399
// prefer to use global window manager to open the style manager, if possible!
400-
// this allows reuse of an existing non-modal window instead of opening a new modal window
401-
if ( !QgsGui::windowManager() || !QgsGui::windowManager()->openStandardDialog( QgsWindowManagerInterface::DialogStyleManager ) )
400+
// this allows reuse of an existing non-modal window instead of opening a new modal window.
401+
// Note that we only use the non-modal dialog if we're open in the panel -- if we're already
402+
// open as part of a modal dialog, then we MUST use another modal dialog or the result will
403+
// not be focusable!
404+
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
405+
if ( !panel || !panel->dockMode()
406+
|| !QgsGui::windowManager()
407+
|| !QgsGui::windowManager()->openStandardDialog( QgsWindowManagerInterface::DialogStyleManager ) )
402408
{
403409
// fallback to modal dialog
404410
QgsStyleManagerDialog dlg( mStyle, this );

0 commit comments

Comments
 (0)