Don't open non-modal dialog from a modal symbol selector dialog

This commit is contained in:
Nyall Dawson 2018-09-14 11:05:17 +10:00
parent 3b64c34b05
commit 8288debe55
3 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/***************************************************************************
qgswindowmanagerinterface.cpp
-----------------------------
qgsappwindowmanager.cpp
-----------------------
Date : September 2018
Copyright : (C) 2018 Nyall Dawson
Email : nyall dot dawson at gmail dot com
@ -59,8 +59,8 @@ QWidget *QgsAppWindowManager::openApplicationDialog( QgsAppWindowManager::Applic
}
mLayoutManagerDialog->show();
mLayoutManagerDialog->activate();
return mLayoutManagerDialog;
}
return nullptr;
}
return nullptr;
}

View File

@ -1,6 +1,6 @@
/***************************************************************************
qgswindowmanagerinterface.h
---------------------------
qgsappwindowmanager.h
---------------------
Date : September 2018
Copyright : (C) 2018 Nyall Dawson
Email : nyall dot dawson at gmail dot com

View File

@ -397,8 +397,14 @@ void QgsSymbolsListWidget::updateModelFilters()
void QgsSymbolsListWidget::openStyleManager()
{
// prefer to use global window manager to open the style manager, if possible!
// this allows reuse of an existing non-modal window instead of opening a new modal window
if ( !QgsGui::windowManager() || !QgsGui::windowManager()->openStandardDialog( QgsWindowManagerInterface::DialogStyleManager ) )
// this allows reuse of an existing non-modal window instead of opening a new modal window.
// Note that we only use the non-modal dialog if we're open in the panel -- if we're already
// open as part of a modal dialog, then we MUST use another modal dialog or the result will
// not be focusable!
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
if ( !panel || !panel->dockMode()
|| !QgsGui::windowManager()
|| !QgsGui::windowManager()->openStandardDialog( QgsWindowManagerInterface::DialogStyleManager ) )
{
// fallback to modal dialog
QgsStyleManagerDialog dlg( mStyle, this );