diff --git a/python/PyQt6/core/auto_additions/qgsgeometry.py b/python/PyQt6/core/auto_additions/qgsgeometry.py index 3af46379076..c8dc6afb58e 100644 --- a/python/PyQt6/core/auto_additions/qgsgeometry.py +++ b/python/PyQt6/core/auto_additions/qgsgeometry.py @@ -14,7 +14,6 @@ try: QgsGeometry.collectGeometry = staticmethod(QgsGeometry.collectGeometry) QgsGeometry.createWedgeBuffer = staticmethod(QgsGeometry.createWedgeBuffer) QgsGeometry.createWedgeBufferFromAngles = staticmethod(QgsGeometry.createWedgeBufferFromAngles) - QgsGeometry.name = staticmethod(QgsGeometry.name) QgsGeometry.unaryUnion = staticmethod(QgsGeometry.unaryUnion) QgsGeometry.polygonize = staticmethod(QgsGeometry.polygonize) QgsGeometry.fromQPointF = staticmethod(QgsGeometry.fromQPointF) diff --git a/python/PyQt6/core/auto_generated/geometry/qgsgeometry.sip.in b/python/PyQt6/core/auto_generated/geometry/qgsgeometry.sip.in index a1ec175e5d0..931d6ce6911 100644 --- a/python/PyQt6/core/auto_generated/geometry/qgsgeometry.sip.in +++ b/python/PyQt6/core/auto_generated/geometry/qgsgeometry.sip.in @@ -329,11 +329,6 @@ Polygon geometry. .. versionadded:: 3.40 %End - static QString name( Qgis::GeometryType type ); -%Docstring -Returns a user friendly name as a string out of the type -%End - void fromWkb( const QByteArray &wkb ); %Docstring @@ -353,11 +348,6 @@ etc.) Returns type of the geometry as a :py:class:`Qgis`.GeometryType .. seealso:: :py:func:`wkbType` -%End - - QString typeName() const /HoldGIL/; -%Docstring -Returns the type name as a string %End bool isEmpty() const /HoldGIL/; diff --git a/python/PyQt6/core/auto_generated/processing/qgsprocessingoutputs.sip.in b/python/PyQt6/core/auto_generated/processing/qgsprocessingoutputs.sip.in index 218046cdb53..5bb1fff8e14 100644 --- a/python/PyQt6/core/auto_generated/processing/qgsprocessingoutputs.sip.in +++ b/python/PyQt6/core/auto_generated/processing/qgsprocessingoutputs.sip.in @@ -69,7 +69,7 @@ Constructor for QgsProcessingOutputDefinition. %Docstring Returns the color to use for the output in model designer windows. -.. versionadded:: 3.44 +.. versionadded:: 4.0 %End virtual QString type() const = 0; diff --git a/python/PyQt6/core/auto_generated/processing/qgsprocessingparameters.sip.in b/python/PyQt6/core/auto_generated/processing/qgsprocessingparameters.sip.in index 07cea353250..6d3495e57d1 100644 --- a/python/PyQt6/core/auto_generated/processing/qgsprocessingparameters.sip.in +++ b/python/PyQt6/core/auto_generated/processing/qgsprocessingparameters.sip.in @@ -366,8 +366,10 @@ Constructor for QgsProcessingParameterDefinition. virtual QColor modelColor() const; %Docstring -Returns the color to use for the parameter type in model designer -windows. +Returns the color to use for the parameter in model designer windows. + +The default implementation retrieves the color from the parameter type, +see :py:func:`QgsProcessingParameterType.modelColor()`. .. versionadded:: 4.0 %End diff --git a/python/PyQt6/core/auto_generated/processing/qgsprocessingparametertype.sip.in b/python/PyQt6/core/auto_generated/processing/qgsprocessingparametertype.sip.in index 18ee600dbd3..6e61be5eaed 100644 --- a/python/PyQt6/core/auto_generated/processing/qgsprocessingparametertype.sip.in +++ b/python/PyQt6/core/auto_generated/processing/qgsprocessingparametertype.sip.in @@ -188,8 +188,8 @@ for the parameter. %Docstring Returns the color to use for the parameter in model designer windows. -The default implementation retrieves the color from the parameter type, -see :py:func:`QgsProcessingParameterType.modelColor()`. +The default implementation returns +:py:func:`~QgsProcessingParameterType.defaultModelColor`. .. versionadded:: 4.0 %End diff --git a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in index cc9eb8d90ad..8f164be25ba 100644 --- a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in +++ b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in @@ -330,6 +330,8 @@ Updates the item's button positions, based on the current item rect. %Docstring Returns the fallback color if the parameter or output does not have a specific color. + +.. versionadded:: 4.0 %End }; QFlags operator|(QgsModelComponentGraphicItem::Flag f1, QFlags f2); diff --git a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in index a01a8afbc65..81eb8a98cc2 100644 --- a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in +++ b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in @@ -182,7 +182,6 @@ Return the component associated to the socket. %Docstring Return the parent graphic item associated to the socket. %End - QColor socketColor() const; %Docstring Returns the color of the socket based on the type of data the param @@ -200,7 +199,6 @@ Returns ``True`` if the parameter is set to the default parameter value. signals: - }; diff --git a/python/core/auto_additions/qgsgeometry.py b/python/core/auto_additions/qgsgeometry.py index 3af46379076..c8dc6afb58e 100644 --- a/python/core/auto_additions/qgsgeometry.py +++ b/python/core/auto_additions/qgsgeometry.py @@ -14,7 +14,6 @@ try: QgsGeometry.collectGeometry = staticmethod(QgsGeometry.collectGeometry) QgsGeometry.createWedgeBuffer = staticmethod(QgsGeometry.createWedgeBuffer) QgsGeometry.createWedgeBufferFromAngles = staticmethod(QgsGeometry.createWedgeBufferFromAngles) - QgsGeometry.name = staticmethod(QgsGeometry.name) QgsGeometry.unaryUnion = staticmethod(QgsGeometry.unaryUnion) QgsGeometry.polygonize = staticmethod(QgsGeometry.polygonize) QgsGeometry.fromQPointF = staticmethod(QgsGeometry.fromQPointF) diff --git a/python/core/auto_generated/geometry/qgsgeometry.sip.in b/python/core/auto_generated/geometry/qgsgeometry.sip.in index 59eb8bed271..8e46bfa96b0 100644 --- a/python/core/auto_generated/geometry/qgsgeometry.sip.in +++ b/python/core/auto_generated/geometry/qgsgeometry.sip.in @@ -329,11 +329,6 @@ Polygon geometry. .. versionadded:: 3.40 %End - static QString name( Qgis::GeometryType type ); -%Docstring -Returns a user friendly name as a string out of the type -%End - void fromWkb( const QByteArray &wkb ); %Docstring @@ -353,11 +348,6 @@ etc.) Returns type of the geometry as a :py:class:`Qgis`.GeometryType .. seealso:: :py:func:`wkbType` -%End - - QString typeName() const /HoldGIL/; -%Docstring -Returns the type name as a string %End bool isEmpty() const /HoldGIL/; diff --git a/python/core/auto_generated/processing/qgsprocessingoutputs.sip.in b/python/core/auto_generated/processing/qgsprocessingoutputs.sip.in index 218046cdb53..5bb1fff8e14 100644 --- a/python/core/auto_generated/processing/qgsprocessingoutputs.sip.in +++ b/python/core/auto_generated/processing/qgsprocessingoutputs.sip.in @@ -69,7 +69,7 @@ Constructor for QgsProcessingOutputDefinition. %Docstring Returns the color to use for the output in model designer windows. -.. versionadded:: 3.44 +.. versionadded:: 4.0 %End virtual QString type() const = 0; diff --git a/python/core/auto_generated/processing/qgsprocessingparameters.sip.in b/python/core/auto_generated/processing/qgsprocessingparameters.sip.in index 7bf4918ae9a..04c22c6dfda 100644 --- a/python/core/auto_generated/processing/qgsprocessingparameters.sip.in +++ b/python/core/auto_generated/processing/qgsprocessingparameters.sip.in @@ -366,8 +366,10 @@ Constructor for QgsProcessingParameterDefinition. virtual QColor modelColor() const; %Docstring -Returns the color to use for the parameter type in model designer -windows. +Returns the color to use for the parameter in model designer windows. + +The default implementation retrieves the color from the parameter type, +see :py:func:`QgsProcessingParameterType.modelColor()`. .. versionadded:: 4.0 %End diff --git a/python/core/auto_generated/processing/qgsprocessingparametertype.sip.in b/python/core/auto_generated/processing/qgsprocessingparametertype.sip.in index 18ee600dbd3..6e61be5eaed 100644 --- a/python/core/auto_generated/processing/qgsprocessingparametertype.sip.in +++ b/python/core/auto_generated/processing/qgsprocessingparametertype.sip.in @@ -188,8 +188,8 @@ for the parameter. %Docstring Returns the color to use for the parameter in model designer windows. -The default implementation retrieves the color from the parameter type, -see :py:func:`QgsProcessingParameterType.modelColor()`. +The default implementation returns +:py:func:`~QgsProcessingParameterType.defaultModelColor`. .. versionadded:: 4.0 %End diff --git a/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in b/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in index 98c093529d2..12ef46f9744 100644 --- a/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in +++ b/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in @@ -330,6 +330,8 @@ Updates the item's button positions, based on the current item rect. %Docstring Returns the fallback color if the parameter or output does not have a specific color. + +.. versionadded:: 4.0 %End }; QFlags operator|(QgsModelComponentGraphicItem::Flag f1, QFlags f2); diff --git a/python/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in b/python/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in index 62ae740f428..81eb8a98cc2 100644 --- a/python/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in +++ b/python/gui/auto_generated/processing/models/qgsmodelgraphicitem.sip.in @@ -199,7 +199,6 @@ Returns ``True`` if the parameter is set to the default parameter value. signals: - }; diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index 0c4d559b7b5..462434076f4 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -476,19 +476,6 @@ QgsGeometry QgsGeometry::createWedgeBufferFromAngles( const QgsPoint ¢er, do return QgsGeometry( std::move( cp ) ); } -QString QgsGeometry::name( Qgis::GeometryType type ) -{ - switch ( type ) - { - case Qgis::GeometryType::Line: return QString( "Line" ); - case Qgis::GeometryType::Point: return QString( "Point" ); - case Qgis::GeometryType::Polygon: return QString( "Polygon" ); - case Qgis::GeometryType::Null: return QString( "Null" ); - case Qgis::GeometryType::Unknown: - default: return QString( "Unknown" ); - } -} - void QgsGeometry::fromWkb( unsigned char *wkb, int length ) { QgsConstWkbPtr ptr( wkb, length ); @@ -523,16 +510,6 @@ Qgis::GeometryType QgsGeometry::type() const return QgsWkbTypes::geometryType( d->geometry->wkbType() ); } -QString QgsGeometry::typeName() const -{ - if ( !d->geometry ) - { - return QgsGeometry::name( Qgis::GeometryType::Null ); - } - - return QgsGeometry::name( type() ); -} - bool QgsGeometry::isEmpty() const { if ( !d->geometry ) diff --git a/src/core/geometry/qgsgeometry.h b/src/core/geometry/qgsgeometry.h index 2a73977475b..8b87e5969a3 100644 --- a/src/core/geometry/qgsgeometry.h +++ b/src/core/geometry/qgsgeometry.h @@ -380,11 +380,6 @@ class CORE_EXPORT QgsGeometry static QgsGeometry createWedgeBufferFromAngles( const QgsPoint ¢er, double startAngle, double endAngle, double outerRadius, double innerRadius = 0 ); - /** - * Returns a user friendly name as a string out of the type - */ - static QString name( Qgis::GeometryType type ); - /** * Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length. * This class will take ownership of the buffer. @@ -409,11 +404,6 @@ class CORE_EXPORT QgsGeometry */ Qgis::GeometryType type() const SIP_HOLDGIL; - /** - * Returns the type name as a QString - */ - QString typeName() const SIP_HOLDGIL; - /** * Returns TRUE if the geometry is empty (eg a linestring with no vertices, * or a collection with no geometries). A null geometry will always diff --git a/src/core/processing/qgsprocessingoutputs.h b/src/core/processing/qgsprocessingoutputs.h index c88ac3ddc06..fcfec462a41 100644 --- a/src/core/processing/qgsprocessingoutputs.h +++ b/src/core/processing/qgsprocessingoutputs.h @@ -89,7 +89,7 @@ class CORE_EXPORT QgsProcessingOutputDefinition /** * Returns the color to use for the output in model designer windows. * - * \since QGIS 3.44 + * \since QGIS 4.0 */ virtual QColor modelColor() const; diff --git a/src/core/processing/qgsprocessingparameters.cpp b/src/core/processing/qgsprocessingparameters.cpp index a96e3f053c3..6674079c06d 100644 --- a/src/core/processing/qgsprocessingparameters.cpp +++ b/src/core/processing/qgsprocessingparameters.cpp @@ -3054,7 +3054,7 @@ QString QgsProcessingParameterDefinition::userFriendlyString( const QVariant &va else if ( value.userType() == qMetaTypeId() ) { const QgsGeometry g = QgsGeometry::fromRect( value.value() ); - return g.typeName(); + return QgsWkbTypes::geometryDisplayString( g.type() ); } else if ( value.userType() == qMetaTypeId() ) @@ -3063,9 +3063,9 @@ QString QgsProcessingParameterDefinition::userFriendlyString( const QVariant &va if ( !g.isNull() ) { - return QStringLiteral( "[%1] %2" ).arg( g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ), g.typeName() ); + return QStringLiteral( "[%1] %2" ).arg( g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ), QgsWkbTypes::geometryDisplayString( g.type() ) ); } - return g.typeName(); + return QgsWkbTypes::geometryDisplayString( g.type() ); } else if ( value.userType() == qMetaTypeId() ) @@ -4099,7 +4099,7 @@ QString QgsProcessingParameterGeometry::userFriendlyString( const QVariant &valu if ( value.userType() == qMetaTypeId< QgsGeometry>() ) { const QgsGeometry g = value.value(); - return g.typeName(); + return QgsWkbTypes::geometryDisplayString( g.type() ); } else if ( value.userType() == qMetaTypeId() ) @@ -4107,9 +4107,9 @@ QString QgsProcessingParameterGeometry::userFriendlyString( const QVariant &valu const QgsReferencedGeometry g = value.value(); if ( !g.isNull() ) { - return QStringLiteral( "[%1] %2" ).arg( g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ), g.typeName() ); + return QStringLiteral( "[%1] %2" ).arg( g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ), QgsWkbTypes::geometryDisplayString( g.type() ) ); } - return g.typeName(); + return QgsWkbTypes::geometryDisplayString( g.type() ); } else if ( value.userType() == QMetaType::QString ) @@ -4119,7 +4119,7 @@ QString QgsProcessingParameterGeometry::userFriendlyString( const QVariant &valu QgsGeometry g = QgsGeometry::fromWkt( value.toString() ); if ( !g.isNull() ) { - return g.typeName(); + return QgsWkbTypes::geometryDisplayString( g.type() ); } } } diff --git a/src/core/processing/qgsprocessingparameters.h b/src/core/processing/qgsprocessingparameters.h index b7c764de946..beee17a2ab3 100644 --- a/src/core/processing/qgsprocessingparameters.h +++ b/src/core/processing/qgsprocessingparameters.h @@ -462,7 +462,9 @@ class CORE_EXPORT QgsProcessingParameterDefinition virtual ~QgsProcessingParameterDefinition() = default; /** - * Returns the color to use for the parameter type in model designer windows. + * Returns the color to use for the parameter in model designer windows. + * + * The default implementation retrieves the color from the parameter type, see QgsProcessingParameterType::modelColor(). * * \since QGIS 4.0 */ diff --git a/src/core/processing/qgsprocessingparametertype.h b/src/core/processing/qgsprocessingparametertype.h index 45f20572aa8..71c52f0ef0c 100644 --- a/src/core/processing/qgsprocessingparametertype.h +++ b/src/core/processing/qgsprocessingparametertype.h @@ -181,7 +181,7 @@ class CORE_EXPORT QgsProcessingParameterType /** * Returns the color to use for the parameter in model designer windows. * - * The default implementation retrieves the color from the parameter type, see QgsProcessingParameterType::modelColor(). + * The default implementation returns defaultModelColor(). * * \since QGIS 4.0 */ diff --git a/src/gui/processing/models/qgsmodelarrowitem.cpp b/src/gui/processing/models/qgsmodelarrowitem.cpp index 73f6defb2f5..8d794b203f7 100644 --- a/src/gui/processing/models/qgsmodelarrowitem.cpp +++ b/src/gui/processing/models/qgsmodelarrowitem.cpp @@ -106,7 +106,7 @@ void QgsModelArrowItem::paint( QPainter *painter, const QStyleOptionGraphicsItem switch ( mEndMarker ) { case Marker::Circle: - painter->drawEllipse( mEndPoint, 3, 3 ); + painter->drawEllipse( mEndPoint, 3.0, 3.0 ); break; case Marker::ArrowHead: drawArrowHead( painter, mEndPoint, path().pointAtPercent( 1.0 ) - path().pointAtPercent( 0.95 ) ); diff --git a/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp b/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp index be36aa92898..ce96c9ae637 100644 --- a/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp +++ b/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp @@ -572,8 +572,7 @@ void QgsModelComponentGraphicItem::fold( Qt::Edge edge, bool folded ) } else if ( QgsProcessingModelParameter *param = dynamic_cast( mComponent.get() ) ) { - QgsProcessingModelParameter parameterComponent = mModel->parameterComponent( param->parameterName() ); - parameterComponent.setLinksCollapsed( edge, folded ); + mModel->parameterComponent( param->parameterName() ).setLinksCollapsed( edge, folded ); } else if ( QgsProcessingModelOutput *output = dynamic_cast( mComponent.get() ) ) { @@ -1274,11 +1273,10 @@ QString QgsModelChildAlgorithmGraphicItem::linkPointText( Qt::Edge edge, int ind QString name = param->name(); QString title = param->description(); - QgsProcessingModelChildParameterSources paramSources = child->parameterSources().value( name ); QString parameterValueAsString; - if ( paramSources.size() > 0 ) + if ( paramSources.empty() ) { QgsProcessingModelChildParameterSource firstParameterSource = paramSources[0]; diff --git a/src/gui/processing/models/qgsmodelcomponentgraphicitem.h b/src/gui/processing/models/qgsmodelcomponentgraphicitem.h index 41614df81ee..7a9162da161 100644 --- a/src/gui/processing/models/qgsmodelcomponentgraphicitem.h +++ b/src/gui/processing/models/qgsmodelcomponentgraphicitem.h @@ -369,6 +369,8 @@ class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject /** * Returns the fallback color if the parameter or output does not have a specific color. + * + * \since QGIS 4.0 */ QColor fallbackColor() const { return mFallbackColor; };