Skip to content
Permalink
Browse files

Port some more model designer Python code to c++

  • Loading branch information
nyalldawson committed Mar 5, 2020
1 parent eefd04c commit a0e6a374eb9a9ecb221ac98224c526047ac14833
@@ -9,6 +9,7 @@




class QgsModelDesignerDialog : QMainWindow
{
%Docstring
@@ -26,11 +27,26 @@ Model designer dialog base class
%End
public:

QgsModelDesignerDialog( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
QgsModelDesignerDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = 0 );

protected:

virtual void repaintModel( bool showControls = true ) = 0;
virtual QgsProcessingModelAlgorithm *model() = 0;
virtual void addAlgorithm( const QString &algorithmId, const QPointF &pos ) = 0;
virtual void addInput( const QString &inputId, const QPointF &pos ) = 0;

QToolBar *toolbar();
QAction *actionOpen();
QAction *actionSave();
QAction *actionSaveAs();
QAction *actionSaveInProject();
QAction *actionEditHelp();
QAction *actionRun();
QAction *actionExportImage();

QgsMessageBar *messageBar();
QGraphicsView *view();

};

@@ -0,0 +1,70 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelgraphicsview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsModelGraphicsView : QGraphicsView
{
%Docstring
QGraphicsView subclass representing the model designer.

.. warning::

Not stable API

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsmodelgraphicsview.h"
%End
public:

QgsModelGraphicsView( QWidget *parent = 0 );
%Docstring
Constructor for QgsModelGraphicsView, with the specified ``parent`` widget.
%End

virtual void dragEnterEvent( QDragEnterEvent *event );

virtual void dropEvent( QDropEvent *event );

virtual void dragMoveEvent( QDragMoveEvent *event );

virtual void wheelEvent( QWheelEvent *event );

virtual void enterEvent( QEvent *event );

virtual void mousePressEvent( QMouseEvent *event );

virtual void mouseMoveEvent( QMouseEvent *event );


signals:

void algorithmDropped( const QString &algorithmId, const QPointF &pos );
%Docstring
Emitted when an algorithm is dropped onto the view.
%End

void inputDropped( const QString &inputId, const QPointF &pos );
%Docstring
Emitted when an input parameter is dropped onto the view.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelgraphicsview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -314,6 +314,7 @@
%Include auto_generated/processing/models/qgsmodeldesignerdialog.sip
%Include auto_generated/processing/models/qgsmodelgraphicitem.sip
%Include auto_generated/processing/models/qgsmodelgraphicsscene.sip
%Include auto_generated/processing/models/qgsmodelgraphicsview.sip
%Include auto_generated/raster/qgscolorrampshaderwidget.sip
%Include auto_generated/raster/qgshillshaderendererwidget.sip
%Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip
@@ -122,7 +122,7 @@ def runModel(self):
ProcessingDropHandler.runAlg(self.path())

def editModel(self):
dlg = ModelerDialog()
dlg = ModelerDialog.create()
dlg.loadModel(self.path())
dlg.show()

@@ -332,7 +332,7 @@ def toolboxVisibilityChanged(self, visible):
self.toolboxAction.setChecked(visible)

def openModeler(self):
dlg = ModelerDialog()
dlg = ModelerDialog.create()
dlg.update_model.connect(self.updateModel)
dlg.show()

@@ -26,6 +26,7 @@
from qgis.PyQt.QtCore import QCoreApplication

from qgis.core import QgsApplication
from qgis.utils import iface

from processing.gui.ToolboxAction import ToolboxAction
from processing.modeler.ModelerDialog import ModelerDialog
@@ -43,7 +44,7 @@ def getIcon(self):
return QgsApplication.getThemeIcon("/processingModel.svg")

def execute(self):
dlg = ModelerDialog()
dlg = ModelerDialog.create()
dlg.update_model.connect(self.updateModel)
dlg.show()

@@ -44,7 +44,7 @@ def execute(self):
if not ok:
iface.messageBar().pushMessage(QCoreApplication.translate('EditModelAction', 'Cannot edit model: {}').format(msg), level=Qgis.Warning)
else:
dlg = ModelerDialog(alg)
dlg = ModelerDialog.create(alg)
dlg.update_model.connect(self.updateModel)
dlg.show()

0 comments on commit a0e6a37

Please sign in to comment.
You can’t perform that action at this time.