Skip to content

Commit

Permalink
[processing] Fix model designer sometimes opens behind other windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 4, 2022
1 parent 3d5bf07 commit 08d10a3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
Expand Up @@ -65,6 +65,15 @@ Loads a model into the designer from the specified file ``path``.
void setModelScene( QgsModelGraphicsScene *scene /Transfer/ );
%Docstring
Sets the related ``scene``.
%End

public slots:

void activate();
%Docstring
Raise, unminimize and activate this window.

.. versionadded:: 3.24
%End

protected:
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/modeler/EditModelAction.py
Expand Up @@ -43,6 +43,7 @@ def execute(self):
dlg = ModelerDialog.create(alg)
dlg.update_model.connect(self.updateModel)
dlg.show()
dlg.activate()

def updateModel(self):
QgsApplication.processingRegistry().providerById('model').refreshAlgorithms()
Expand Up @@ -55,3 +55,4 @@ def execute(self):
dlg = ModelerDialog.create()
dlg.loadModel(filename)
dlg.show()
dlg.activate()
8 changes: 8 additions & 0 deletions src/gui/processing/models/qgsmodeldesignerdialog.cpp
Expand Up @@ -507,6 +507,14 @@ void QgsModelDesignerDialog::setModelScene( QgsModelGraphicsScene *scene )
oldScene->deleteLater();
}

void QgsModelDesignerDialog::activate()
{
show();
raise();
setWindowState( windowState() & ~Qt::WindowMinimized );
activateWindow();
}

void QgsModelDesignerDialog::updateVariablesGui()
{
mBlockUndoCommands++;
Expand Down
9 changes: 9 additions & 0 deletions src/gui/processing/models/qgsmodeldesignerdialog.h
Expand Up @@ -94,6 +94,15 @@ class GUI_EXPORT QgsModelDesignerDialog : public QMainWindow, public Ui::QgsMode
*/
void setModelScene( QgsModelGraphicsScene *scene SIP_TRANSFER );

public slots:

/**
* Raise, unminimize and activate this window.
*
* \since QGIS 3.24
*/
void activate();

protected:

// cppcheck-suppress pureVirtualCall
Expand Down

0 comments on commit 08d10a3

Please sign in to comment.