Skip to content
Permalink
Browse files

Start moving base classes to c++

  • Loading branch information
nyalldawson committed Mar 1, 2020
1 parent dfa5cb6 commit 16841efa7e3a1dc905b89d5509f7cc5f492e5568
@@ -0,0 +1,46 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelcomponentgraphicitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsModelComponentGraphicItem : QGraphicsObject
{
%Docstring
Base class for graphic items representing model components in the model designer.

.. warning::

Not stable API

.. versionadded:: 3.14
%End

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

QgsModelComponentGraphicItem( QgsProcessingModelComponent *component /Transfer/, QGraphicsItem *parent /TransferThis/ );
%Docstring
Constructor for QgsModelComponentGraphicItem for the specified ``component``, with the specified ``parent`` item.

Ownership of ``component`` is transferred to the item.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelcomponentgraphicitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -27,7 +27,7 @@ A flat button graphic item for use in the Processing model designer.
%End
public:

QgsModelDesignerFlatButtonGraphicItem( QGraphicsItem *parent, const QPicture &picture, const QPointF &position,
QgsModelDesignerFlatButtonGraphicItem( QGraphicsItem *parent /TransferThis/, const QPicture &picture, const QPointF &position,
const QSizeF &size = QSizeF( 16, 16 ) );
%Docstring
Constructor for QgsModelDesignerFlatButtonGraphicItem, with the specified ``parent`` item.
@@ -81,7 +81,7 @@ A button allowing folding or expanding component graphics in the Processing mode
%End
public:

QgsModelDesignerFoldButtonGraphicItem( QGraphicsItem *parent, bool folded, const QPointF &position,
QgsModelDesignerFoldButtonGraphicItem( QGraphicsItem *parent /TransferThis/, bool folded, const QPointF &position,
const QSizeF &size = QSizeF( 11, 11 ) );
%Docstring
Constructor for QgsModelDesignerFoldButtonGraphicItem, with the specified ``parent`` item.
@@ -0,0 +1,45 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelgraphicsscene.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsModelGraphicsScene : QGraphicsScene
{
%Docstring
QGraphicsScene subclass representing the model designer.

.. warning::

Not stable API

.. versionadded:: 3.14
%End

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

QgsModelGraphicsScene( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsModelGraphicsScene with the specified ``parent`` object.
%End


};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/models/qgsmodelgraphicsscene.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -309,7 +309,9 @@
%Include auto_generated/processing/qgsprocessingtoolboxmodel.sip
%Include auto_generated/processing/qgsprocessingtoolboxtreeview.sip
%Include auto_generated/processing/qgsprocessingwidgetwrapper.sip
%Include auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip
%Include auto_generated/processing/models/qgsmodelgraphicitem.sip
%Include auto_generated/processing/models/qgsmodelgraphicsscene.sip
%Include auto_generated/raster/qgscolorrampshaderwidget.sip
%Include auto_generated/raster/qgshillshaderendererwidget.sip
%Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip
@@ -27,15 +27,16 @@
from qgis.core import (QgsProcessingParameterDefinition,
QgsProcessingModelChildParameterSource,
QgsExpression)
from qgis.gui import QgsModelGraphicsScene
from processing.modeler.ModelerGraphicItem import ModelerGraphicItem
from processing.modeler.ModelerArrowItem import ModelerArrowItem
from processing.tools.dataobjects import createContext


class ModelerScene(QGraphicsScene):
class ModelerScene(QgsModelGraphicsScene):

def __init__(self, parent=None, dialog=None):
super(ModelerScene, self).__init__(parent)
super().__init__(parent)
self.paramItems = {}
self.algItems = {}
self.outputItems = {}
@@ -252,7 +252,9 @@ SET(QGIS_GUI_SRCS
processing/qgsprocessingwidgetwrapper.cpp
processing/qgsprocessingwidgetwrapperimpl.cpp

processing/models/qgsmodelcomponentgraphicitem.cpp
processing/models/qgsmodelgraphicitem.cpp
processing/models/qgsmodelgraphicsscene.cpp

providers/gdal/qgsgdalsourceselect.cpp
providers/gdal/qgsgdalguiprovider.cpp
@@ -880,7 +882,9 @@ SET(QGIS_GUI_HDRS
processing/qgsprocessingwidgetwrapper.h
processing/qgsprocessingwidgetwrapperimpl.h

processing/models/qgsmodelcomponentgraphicitem.h
processing/models/qgsmodelgraphicitem.h
processing/models/qgsmodelgraphicsscene.h

providers/gdal/qgsgdalguiprovider.h
providers/gdal/qgsgdalsourceselect.h
@@ -1072,6 +1076,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core/metadata
${CMAKE_SOURCE_DIR}/src/core/numericformats
${CMAKE_SOURCE_DIR}/src/core/processing
${CMAKE_SOURCE_DIR}/src/core/processing/models
${CMAKE_SOURCE_DIR}/src/core/mesh
${CMAKE_SOURCE_DIR}/src/core/pal
${CMAKE_SOURCE_DIR}/src/core/providers/memory
@@ -0,0 +1,29 @@
/***************************************************************************
qgsmodelcomponentgraphicitem.cpp
----------------------------------
Date : March 2020
Copyright : (C) 2020 Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsmodelcomponentgraphicitem.h"

///@cond NOT_STABLE


///@endcond


QgsModelComponentGraphicItem::QgsModelComponentGraphicItem( QgsProcessingModelComponent *component, QGraphicsItem *parent )
: QGraphicsObject( parent )
, mComponent( component )
{

}
@@ -0,0 +1,55 @@
/***************************************************************************
qgsmodelcomponentgraphicitem.h
----------------------------------
Date : March 2020
Copyright : (C) 2020 Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSMODELCOMPONENTGRAPHICITEM_H
#define QGSMODELCOMPONENTGRAPHICITEM_H

#include "qgis.h"
#include "qgis_gui.h"
#include "qgsprocessingmodelcomponent.h"
#include <QGraphicsObject>


///@cond NOT_STABLE

/**
* \ingroup gui
* \brief Base class for graphic items representing model components in the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject
{
Q_OBJECT

public:

/**
* Constructor for QgsModelComponentGraphicItem for the specified \a component, with the specified \a parent item.
*
* Ownership of \a component is transferred to the item.
*/
QgsModelComponentGraphicItem( QgsProcessingModelComponent *component SIP_TRANSFER, QGraphicsItem *parent SIP_TRANSFERTHIS );

private:

std::unique_ptr< QgsProcessingModelComponent > mComponent;


};

///@endcond

#endif // QGSMODELCOMPONENTGRAPHICITEM_H
@@ -41,7 +41,7 @@ class GUI_EXPORT QgsModelDesignerFlatButtonGraphicItem : public QGraphicsObject
* The \a picture argument specifies a QPicture object containing the graphic to render
* for the button. The button will be rendered at the specified \a position and \a size.
*/
QgsModelDesignerFlatButtonGraphicItem( QGraphicsItem *parent, const QPicture &picture, const QPointF &position,
QgsModelDesignerFlatButtonGraphicItem( QGraphicsItem *parent SIP_TRANSFERTHIS, const QPicture &picture, const QPointF &position,
const QSizeF &size = QSizeF( 16, 16 ) );

void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr ) override;
@@ -92,7 +92,7 @@ class GUI_EXPORT QgsModelDesignerFoldButtonGraphicItem : public QgsModelDesigner
*
* The button will be rendered at the specified \a position and \a size.
*/
QgsModelDesignerFoldButtonGraphicItem( QGraphicsItem *parent, bool folded, const QPointF &position,
QgsModelDesignerFoldButtonGraphicItem( QGraphicsItem *parent SIP_TRANSFERTHIS, bool folded, const QPointF &position,
const QSizeF &size = QSizeF( 11, 11 ) );

void mousePressEvent( QGraphicsSceneMouseEvent *event ) override;
@@ -0,0 +1,27 @@
/***************************************************************************
qgsmodelgraphicsscene.cpp
----------------------------------
Date : March 2020
Copyright : (C) 2020 Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsmodelgraphicsscene.h"

///@cond NOT_STABLE

QgsModelGraphicsScene::QgsModelGraphicsScene( QObject *parent )
: QGraphicsScene( parent )
{

}

///@endcond

@@ -0,0 +1,48 @@
/***************************************************************************
qgsmodelgraphicsscene.h
-----------------------
Date : March 2020
Copyright : (C) 2020 Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSMODELGRAPHICSCENE_H
#define QGSMODELGRAPHICSCENE_H

#include "qgis.h"
#include "qgis_gui.h"
#include <QGraphicsScene>


///@cond NOT_STABLE

/**
* \ingroup gui
* \brief QGraphicsScene subclass representing the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelGraphicsScene : public QGraphicsScene
{
Q_OBJECT

public:

/**
* Constructor for QgsModelGraphicsScene with the specified \a parent object.
*/
QgsModelGraphicsScene( QObject *parent SIP_TRANSFERTHIS = nullptr );


};

///@endcond

#endif // QGSMODELCOMPONENTGRAPHICITEM_H

0 comments on commit 16841ef

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