Compare commits

...

70 Commits

Author SHA1 Message Date
Jonathan Lurie
e158ebb876
Merge 4bab898301d3e80bea6ab38f864a5a37fb2f2685 into 2e07d9829f38ea12661050415d09e28675c961bd 2025-10-01 15:15:30 +02:00
Nyall Dawson
2e07d9829f Fix build 2025-10-01 18:00:57 +10:00
Nyall Dawson
7d31cc1dab Run code_cleanup script 2025-10-01 18:00:57 +10:00
qgis-bot
e28d12d058 auto sipify 🍺 2025-10-01 05:54:45 +00:00
Denis Rouzaud
0f1c0de0f8
Merge pull request #63214 from nyalldawson/annotation3d
Support rendering annotation layer markers as 3d billboards
2025-10-01 07:52:11 +02:00
qgis-bot
82d7ab9b62 auto sipify 🍺 2025-10-01 03:49:17 +00:00
Nyall Dawson
8bc1f639bb Update tests 2025-10-01 13:46:41 +10:00
Nyall Dawson
928bdd8cc4 Fix tooltip formatting for console actions
The tooltip text should be in bold, not the shortcut
2025-10-01 13:46:41 +10:00
Nyall Dawson
1db5d1d246 Add common actions for run script, run selection
Allows these shortcuts to be customised
2025-10-01 13:46:41 +10:00
Nyall Dawson
1e3167082c Use correct shortcut in context menu for console script editor
And add reformat code action to menu
2025-10-01 13:46:41 +10:00
Nyall Dawson
c6accd8517 Fix more misleading names
These objects are actions, not buttons
2025-10-01 13:46:41 +10:00
Nyall Dawson
41962a0a24 Use correct user-set shortcuts for console script editor code actions
And rename member variable for correctness
2025-10-01 13:46:41 +10:00
Nyall Dawson
0fc8b37487 Set shortcut for script editor toggle comment action 2025-10-01 13:46:41 +10:00
Nyall Dawson
1c53ab415b Use registered shortcuts for code editor comment/reformat actions 2025-10-01 13:46:41 +10:00
Nyall Dawson
579a818ce7 Add sequenceForCommonAction 2025-10-01 13:46:41 +10:00
Nyall Dawson
5ed5f51121 [api] Add framework to handle common actions in shortcuts manager
Common actions allow for shortcuts to be registered for actions
which do not yet exist, or which are not associated with a single
global QAction object attached to at the application level. For
example, code editor actions which will be created as children
of individual code editor widgets, but which should have
shortcuts available for user configuration via the shortcuts
manager dialog.
2025-10-01 13:46:41 +10:00
Nyall Dawson
62fbbe6392 Refactor to extract utility function 2025-10-01 13:46:41 +10:00
Nyall Dawson
ac1260d159 Handle shortcut manager sections which don't have trailing "/" 2025-10-01 13:46:41 +10:00
Nyall Dawson
d9a4c80aa9 Rename method to more generic name 2025-10-01 13:46:41 +10:00
Nyall Dawson
af0208c974
Refine z range logic 2025-10-01 12:47:45 +10:00
Nyall Dawson
a01770e5cb
[feature] Support rendering annotation layer markers as 3d billboards
This commit adds a new option for showing annotation layers in 3d maps.

From the annotation layer properties, 3d tab, users can set the layer
to render as 3d billboards. When activated, all MARKERS from the layer
will be shown as floating billboard symbols above the 3d map. (lines,
polygons, and text items from the layer are ignored).

Users have control over the terrain clamping and offset for the
billboards, and whether or not "callout" lines should be shown (vertical
lines joining the billboard to the corresponding location on the
terrain surface)
2025-10-01 10:56:50 +10:00
Nyall Dawson
d63653925c Fix 3d build 2025-10-01 10:54:09 +10:00
Jonathan Lurie
4bab898301 removed blank line 2025-09-17 14:09:22 +02:00
Jonathan Lurie
eca451bf4a addresing review 2025-09-08 11:39:44 +02:00
Jonathan Lurie
e6efa0a5c6 fix after review 2025-09-04 13:32:32 +02:00
Jonathan Lurie
0ae2327be1
Merge branch 'master' into model-designer-update 2025-07-04 09:59:16 +02:00
jonathanlurie
64bef5c290 adding some more UT 2025-07-03 16:38:43 +02:00
jonathanlurie
e30a729a28 fix friendly string for point, add UT 2025-07-03 11:54:34 +02:00
jonathanlurie
40b7b18358 WIP userFriendlString testing 2025-06-23 17:35:03 +02:00
jonathanlurie
b1fcfad0fa updating comments 2025-06-20 10:24:06 +02:00
jonathanlurie
939fcf9ea2 using static default color 2025-06-19 15:32:10 +02:00
jonathanlurie
16cdae82ce Better function naming 2025-06-19 15:27:19 +02:00
jonathanlurie
2743ea2fa7 avoid abbreviations 3 2025-06-19 15:03:18 +02:00
jonathanlurie
93dd35920a avoid abbreviations 2 2025-06-19 14:57:20 +02:00
jonathanlurie
3f5c2a7a1b avoid abbreviations 2025-06-19 14:56:50 +02:00
jonathanlurie
9c1035e773 rename method to socketColor 2025-06-19 14:54:48 +02:00
jonathanlurie
293be69903 better crs string 2025-06-19 14:29:43 +02:00
jonathanlurie
8bd12426d7 add translations for invalid data time 2025-06-19 14:23:09 +02:00
jonathanlurie
17b26806d6 wkt encoded geometries now display geom type in graphic item 2025-06-19 13:29:31 +02:00
jonathanlurie
b29f446c7c add geometry type name getter 2025-06-19 10:31:25 +02:00
jonathanlurie
76ac2f916b moved param colors to types 2025-06-13 15:16:20 +02:00
jonathanlurie
7ba380c851 apply fixes 2025-06-13 13:12:27 +02:00
jonathanlurie
9670c98118 Merge branch 'master' into model-designer-update 2025-06-04 11:35:59 +02:00
jonathanlurie
5b7c964178 Merge branch 'master' into model-designer-update 2025-05-27 09:15:58 +02:00
jonathanlurie
8a8c0f4501 make fields shorter 2025-05-26 16:54:50 +02:00
jonathanlurie
a44563fd4d shorter gradient 2025-05-26 15:22:03 +02:00
jonathanlurie
5a121ceb95 gradient along path when type is fluid 2025-05-26 14:32:37 +02:00
jonathanlurie
620db939b8 Update color groups 2025-05-23 16:34:56 +02:00
jonathanlurie
0f54c08f4c Merge branch 'master' into model-designer-update 2025-05-23 09:59:14 +02:00
jonathanlurie
4ebabb5ba6 Merge branch 'master' into model-designer-update 2025-05-20 16:47:16 +02:00
jonathanlurie
cce86d7cff WIP tailored prompt for param type 2025-05-16 16:53:38 +02:00
jonathanlurie
0e1e1505eb output socket now are always filled 2025-05-15 11:51:28 +02:00
jonathanlurie
f84c4ff43b merging switch cases 2025-05-15 11:35:51 +02:00
jonathanlurie
1af32010e8 Adjusted start socket position and style 2025-05-15 11:34:28 +02:00
jonathanlurie
1f622fb9b5 moving the socket with a small offset to better align 2025-05-14 16:53:29 +02:00
jonathanlurie
287fc1b0f2 simplified getting socket colors 2025-05-14 16:26:07 +02:00
jonathanlurie
46ebf8dff2 moved virtual method body to cpp file 2 2025-05-14 15:07:25 +02:00
jonathanlurie
1dda85e367 moved virtual method body to cpp file 2025-05-14 14:08:36 +02:00
jonathanlurie
f36e86ff5d refectored param color logic 2025-05-13 18:01:20 +02:00
jonathanlurie
c4b0d73b7d removed unnecessary else returns 2025-05-13 14:33:51 +02:00
jonathanlurie
9bacaee3c6 return empty string to signal error 2025-05-13 14:26:16 +02:00
jonathanlurie
545e264c70 removed var used only once 2025-05-13 14:14:30 +02:00
jonathanlurie
9b95398cdb simplified button positioning 2025-05-13 14:12:30 +02:00
jonathanlurie
2fe7c92204 now using virtual method for getting param data type 2025-05-12 16:47:56 +02:00
jonathanlurie
19e318fb1b formatting 2025-05-12 15:51:52 +02:00
jonathanlurie
12c1264293 testing with better line jumps 2 2025-05-12 15:15:49 +02:00
jonathanlurie
9b45dedeb7 Added color names 2025-05-12 15:13:05 +02:00
jonathanlurie
a7b079752a Merge branch 'master' into model-designer-update 2025-05-12 15:02:48 +02:00
github-actions[bot]
192298a388 auto-fix pre-commit issues 2025-05-08 07:16:15 +00:00
jonathanlurie
99613254d1 adding model designer style customization 2025-05-07 18:39:13 +02:00
145 changed files with 3722 additions and 573 deletions

View File

@ -6,6 +6,7 @@
%Include auto_generated/qgs3dtypes.sip
%Include auto_generated/qgs3dmapcanvas.sip
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
%Include auto_generated/qgsannotationlayer3drenderer.sip
%Include auto_generated/qgscameracontroller.sip
%Include auto_generated/qgscamerapose.sip
%Include auto_generated/qgslayoutitem3dmap.sip

View File

@ -0,0 +1,9 @@
# The following has been generated automatically from src/3d/qgsannotationlayer3drenderer.h
try:
QgsAnnotationLayer3DRendererMetadata.__overridden_methods__ = ['createRenderer']
except (NameError, AttributeError):
pass
try:
QgsAnnotationLayer3DRenderer.__overridden_methods__ = ['type', 'clone', 'writeXml', 'readXml', 'resolveReferences']
except (NameError, AttributeError):
pass

View File

@ -0,0 +1,154 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsannotationlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
// this is needed for the "convert to subclass" code below to compile
%ModuleHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
class QgsAnnotationLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
{
%Docstring(signature="appended")
Metadata for annotation layer 3D renderer to allow creation of its
instances from XML.
.. warning::
This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
public:
QgsAnnotationLayer3DRendererMetadata();
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Creates an instance of a 3D renderer based on a DOM element with
renderer configuration
%End
};
class QgsAnnotationLayer3DRenderer : QgsAbstract3DRenderer
{
%Docstring(signature="appended")
3D renderers for annotation layers.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
sipType = sipType_QgsAnnotationLayer3DRenderer;
else
sipType = nullptr;
%End
public:
QgsAnnotationLayer3DRenderer();
void setLayer( QgsAnnotationLayer *layer );
%Docstring
Sets the annotation layer associated with the renderer.
.. seealso:: :py:func:`layer`
%End
QgsAnnotationLayer *layer() const;
%Docstring
Returns the annotation layer associated with the renderer.
.. seealso:: :py:func:`setLayer`
%End
virtual QString type() const;
virtual QgsAnnotationLayer3DRenderer *clone() const /Factory/;
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void resolveReferences( const QgsProject &project );
Qgis::AltitudeClamping altitudeClamping() const;
%Docstring
Returns the altitude clamping method, which determines the vertical
position of annotations.
.. seealso:: :py:func:`setAltitudeClamping`
%End
void setAltitudeClamping( Qgis::AltitudeClamping clamping );
%Docstring
Sets the altitude ``clamping`` method, which determines the vertical
position of annotations.
.. seealso:: :py:func:`altitudeClamping`
%End
double zOffset() const;
%Docstring
Returns the z offset, which is a fixed offset amount which should be
added to z values for the annotations.
.. seealso:: :py:func:`setZOffset`
%End
void setZOffset( double offset );
%Docstring
Sets the z ``offset``, which is a fixed offset amount which will be
added to z values for the annotations.
.. seealso:: :py:func:`zOffset`
%End
bool showCalloutLines() const;
%Docstring
Returns ``True`` if callout lines are shown, vertically joining the
annotations to the terrain.
.. seealso:: :py:func:`setShowCalloutLines`
%End
void setShowCalloutLines( bool show );
%Docstring
Sets whether callout lines are shown, vertically joining the annotations
to the terrain.
.. seealso:: :py:func:`showCalloutLines`
%End
private:
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsannotationlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/

View File

@ -246,6 +246,22 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
QgsAnnotationLayer3DRenderer.altitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L100
QgsAnnotationLayer3DRenderer.clone: src/3d/qgsannotationlayer3drenderer.h#L88
QgsAnnotationLayer3DRenderer.layer: src/3d/qgsannotationlayer3drenderer.h#L85
QgsAnnotationLayer3DRenderer.readXml: src/3d/qgsannotationlayer3drenderer.h#L92
QgsAnnotationLayer3DRenderer.resolveReferences: src/3d/qgsannotationlayer3drenderer.h#L93
QgsAnnotationLayer3DRenderer.setAltitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L107
QgsAnnotationLayer3DRenderer.setLayer: src/3d/qgsannotationlayer3drenderer.h#L78
QgsAnnotationLayer3DRenderer.setShowCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L135
QgsAnnotationLayer3DRenderer.setZOffset: src/3d/qgsannotationlayer3drenderer.h#L121
QgsAnnotationLayer3DRenderer.showCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L128
QgsAnnotationLayer3DRenderer.type: src/3d/qgsannotationlayer3drenderer.h#L87
QgsAnnotationLayer3DRenderer.writeXml: src/3d/qgsannotationlayer3drenderer.h#L91
QgsAnnotationLayer3DRenderer.zOffset: src/3d/qgsannotationlayer3drenderer.h#L114
QgsAnnotationLayer3DRenderer: src/3d/qgsannotationlayer3drenderer.h#L59
QgsAnnotationLayer3DRendererMetadata.createRenderer: src/3d/qgsannotationlayer3drenderer.h#L50
QgsAnnotationLayer3DRendererMetadata: src/3d/qgsannotationlayer3drenderer.h#L44
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368

View File

@ -262,7 +262,7 @@ if (WITH_3D)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/3d/project.py.in ${CMAKE_CURRENT_BINARY_DIR}/3d/project.py @ONLY)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/3d/pyproject.toml.temp" "${toml}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/3d/pyproject.toml.temp ${CMAKE_CURRENT_BINARY_DIR}/3d/pyproject.toml)
SET(SIP_CONCAT_PARTS 10) # 3D doesn't have enough .sip files to fill 15+ .cpp files
SET(SIP_CONCAT_PARTS 8) # 3D doesn't have enough .sip files to fill 15+ .cpp files
GENERATE_SIP_PYTHON_MODULE_CODE(qgis._3d_p 3d/3d.sip "${sip_files_3d}" cpp_files)
BUILD_SIP_PYTHON_MODULE(qgis._3d_p 3d/3d.sip ${cpp_files} "" qgis_core qgis_3d)
endif()

View File

@ -6,6 +6,7 @@
%Include auto_generated/qgs3dtypes.sip
%Include auto_generated/qgs3dmapcanvas.sip
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
%Include auto_generated/qgsannotationlayer3drenderer.sip
%Include auto_generated/qgscameracontroller.sip
%Include auto_generated/qgscamerapose.sip
%Include auto_generated/qgslayoutitem3dmap.sip

View File

@ -0,0 +1,9 @@
# The following has been generated automatically from src/3d/qgsannotationlayer3drenderer.h
try:
QgsAnnotationLayer3DRendererMetadata.__overridden_methods__ = ['createRenderer']
except (NameError, AttributeError):
pass
try:
QgsAnnotationLayer3DRenderer.__overridden_methods__ = ['type', 'clone', 'writeXml', 'readXml', 'resolveReferences']
except (NameError, AttributeError):
pass

View File

@ -0,0 +1,154 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsannotationlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
// this is needed for the "convert to subclass" code below to compile
%ModuleHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
class QgsAnnotationLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
{
%Docstring(signature="appended")
Metadata for annotation layer 3D renderer to allow creation of its
instances from XML.
.. warning::
This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
public:
QgsAnnotationLayer3DRendererMetadata();
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Creates an instance of a 3D renderer based on a DOM element with
renderer configuration
%End
};
class QgsAnnotationLayer3DRenderer : QgsAbstract3DRenderer
{
%Docstring(signature="appended")
3D renderers for annotation layers.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgsannotationlayer3drenderer.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
sipType = sipType_QgsAnnotationLayer3DRenderer;
else
sipType = nullptr;
%End
public:
QgsAnnotationLayer3DRenderer();
void setLayer( QgsAnnotationLayer *layer );
%Docstring
Sets the annotation layer associated with the renderer.
.. seealso:: :py:func:`layer`
%End
QgsAnnotationLayer *layer() const;
%Docstring
Returns the annotation layer associated with the renderer.
.. seealso:: :py:func:`setLayer`
%End
virtual QString type() const;
virtual QgsAnnotationLayer3DRenderer *clone() const /Factory/;
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void resolveReferences( const QgsProject &project );
Qgis::AltitudeClamping altitudeClamping() const;
%Docstring
Returns the altitude clamping method, which determines the vertical
position of annotations.
.. seealso:: :py:func:`setAltitudeClamping`
%End
void setAltitudeClamping( Qgis::AltitudeClamping clamping );
%Docstring
Sets the altitude ``clamping`` method, which determines the vertical
position of annotations.
.. seealso:: :py:func:`altitudeClamping`
%End
double zOffset() const;
%Docstring
Returns the z offset, which is a fixed offset amount which should be
added to z values for the annotations.
.. seealso:: :py:func:`setZOffset`
%End
void setZOffset( double offset );
%Docstring
Sets the z ``offset``, which is a fixed offset amount which will be
added to z values for the annotations.
.. seealso:: :py:func:`zOffset`
%End
bool showCalloutLines() const;
%Docstring
Returns ``True`` if callout lines are shown, vertically joining the
annotations to the terrain.
.. seealso:: :py:func:`setShowCalloutLines`
%End
void setShowCalloutLines( bool show );
%Docstring
Sets whether callout lines are shown, vertically joining the annotations
to the terrain.
.. seealso:: :py:func:`showCalloutLines`
%End
private:
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsannotationlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/

View File

@ -246,6 +246,22 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
QgsAnnotationLayer3DRenderer.altitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L100
QgsAnnotationLayer3DRenderer.clone: src/3d/qgsannotationlayer3drenderer.h#L88
QgsAnnotationLayer3DRenderer.layer: src/3d/qgsannotationlayer3drenderer.h#L85
QgsAnnotationLayer3DRenderer.readXml: src/3d/qgsannotationlayer3drenderer.h#L92
QgsAnnotationLayer3DRenderer.resolveReferences: src/3d/qgsannotationlayer3drenderer.h#L93
QgsAnnotationLayer3DRenderer.setAltitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L107
QgsAnnotationLayer3DRenderer.setLayer: src/3d/qgsannotationlayer3drenderer.h#L78
QgsAnnotationLayer3DRenderer.setShowCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L135
QgsAnnotationLayer3DRenderer.setZOffset: src/3d/qgsannotationlayer3drenderer.h#L121
QgsAnnotationLayer3DRenderer.showCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L128
QgsAnnotationLayer3DRenderer.type: src/3d/qgsannotationlayer3drenderer.h#L87
QgsAnnotationLayer3DRenderer.writeXml: src/3d/qgsannotationlayer3drenderer.h#L91
QgsAnnotationLayer3DRenderer.zOffset: src/3d/qgsannotationlayer3drenderer.h#L114
QgsAnnotationLayer3DRenderer: src/3d/qgsannotationlayer3drenderer.h#L59
QgsAnnotationLayer3DRendererMetadata.createRenderer: src/3d/qgsannotationlayer3drenderer.h#L50
QgsAnnotationLayer3DRendererMetadata: src/3d/qgsannotationlayer3drenderer.h#L44
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368

View File

@ -1,19 +1,19 @@
# The following has been generated automatically from src/core/processing/qgsprocessingoutputs.h
try:
QgsProcessingOutputMapLayer.typeName = staticmethod(QgsProcessingOutputMapLayer.typeName)
QgsProcessingOutputMapLayer.__overridden_methods__ = ['type']
QgsProcessingOutputMapLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputMapLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputVectorLayer.typeName = staticmethod(QgsProcessingOutputVectorLayer.typeName)
QgsProcessingOutputVectorLayer.__overridden_methods__ = ['type']
QgsProcessingOutputVectorLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputVectorLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputRasterLayer.typeName = staticmethod(QgsProcessingOutputRasterLayer.typeName)
QgsProcessingOutputRasterLayer.__overridden_methods__ = ['type']
QgsProcessingOutputRasterLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputRasterLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -25,13 +25,13 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputMultipleLayers.typeName = staticmethod(QgsProcessingOutputMultipleLayers.typeName)
QgsProcessingOutputMultipleLayers.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputMultipleLayers.__overridden_methods__ = ['type', 'modelColor', 'valueAsString']
QgsProcessingOutputMultipleLayers.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputHtml.typeName = staticmethod(QgsProcessingOutputHtml.typeName)
QgsProcessingOutputHtml.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputHtml.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputHtml.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -43,31 +43,31 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputNumber.typeName = staticmethod(QgsProcessingOutputNumber.typeName)
QgsProcessingOutputNumber.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputNumber.__overridden_methods__ = ['modelColor', 'type', 'valueAsString']
QgsProcessingOutputNumber.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputString.typeName = staticmethod(QgsProcessingOutputString.typeName)
QgsProcessingOutputString.__overridden_methods__ = ['type']
QgsProcessingOutputString.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputString.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputBoolean.typeName = staticmethod(QgsProcessingOutputBoolean.typeName)
QgsProcessingOutputBoolean.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputBoolean.__overridden_methods__ = ['modelColor', 'type', 'valueAsString']
QgsProcessingOutputBoolean.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputFolder.typeName = staticmethod(QgsProcessingOutputFolder.typeName)
QgsProcessingOutputFolder.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputFolder.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputFolder.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputFile.typeName = staticmethod(QgsProcessingOutputFile.typeName)
QgsProcessingOutputFile.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputFile.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputFile.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -79,12 +79,12 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputVectorTileLayer.typeName = staticmethod(QgsProcessingOutputVectorTileLayer.typeName)
QgsProcessingOutputVectorTileLayer.__overridden_methods__ = ['type']
QgsProcessingOutputVectorTileLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputVectorTileLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputDefinition.__virtual_methods__ = ['valueAsString', 'valueAsFormattedString']
QgsProcessingOutputDefinition.__virtual_methods__ = ['modelColor', 'valueAsString', 'valueAsFormattedString']
QgsProcessingOutputDefinition.__abstract_methods__ = ['type']
QgsProcessingOutputDefinition.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -82,7 +82,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterCrs.typeName = staticmethod(QgsProcessingParameterCrs.typeName)
QgsProcessingParameterCrs.fromScriptCode = staticmethod(QgsProcessingParameterCrs.fromScriptCode)
QgsProcessingParameterCrs.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsString', 'valueAsJsonObject']
QgsProcessingParameterCrs.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsString', 'valueAsJsonObject']
QgsProcessingParameterCrs.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -103,7 +103,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterGeometry.typeName = staticmethod(QgsProcessingParameterGeometry.typeName)
QgsProcessingParameterGeometry.fromScriptCode = staticmethod(QgsProcessingParameterGeometry.fromScriptCode)
QgsProcessingParameterGeometry.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterGeometry.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterGeometry.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -137,25 +137,25 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDistance.typeName = staticmethod(QgsProcessingParameterDistance.typeName)
QgsProcessingParameterDistance.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDistance.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDistance.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterArea.typeName = staticmethod(QgsProcessingParameterArea.typeName)
QgsProcessingParameterArea.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterArea.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterArea.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterVolume.typeName = staticmethod(QgsProcessingParameterVolume.typeName)
QgsProcessingParameterVolume.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterVolume.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterVolume.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDuration.typeName = staticmethod(QgsProcessingParameterDuration.typeName)
QgsProcessingParameterDuration.__overridden_methods__ = ['clone', 'type', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDuration.__overridden_methods__ = ['clone', 'type', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterDuration.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -183,7 +183,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterEnum.typeName = staticmethod(QgsProcessingParameterEnum.typeName)
QgsProcessingParameterEnum.fromScriptCode = staticmethod(QgsProcessingParameterEnum.fromScriptCode)
QgsProcessingParameterEnum.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterEnum.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterEnum.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -326,7 +326,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterDateTime.typeName = staticmethod(QgsProcessingParameterDateTime.typeName)
QgsProcessingParameterDateTime.fromScriptCode = staticmethod(QgsProcessingParameterDateTime.fromScriptCode)
QgsProcessingParameterDateTime.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'toolTip', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDateTime.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'toolTip', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterDateTime.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -389,7 +389,7 @@ try:
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDefinition.__virtual_methods__ = ['isDestination', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsJsonObject', 'valueAsString', 'valueAsStringList', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'dependsOnOtherParameters', 'toolTip']
QgsProcessingParameterDefinition.__virtual_methods__ = ['modelColor', 'userFriendlyString', 'isDestination', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsJsonObject', 'valueAsString', 'valueAsStringList', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'dependsOnOtherParameters', 'toolTip']
QgsProcessingParameterDefinition.__abstract_methods__ = ['clone', 'type']
QgsProcessingParameterDefinition.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -1,6 +1,7 @@
# The following has been generated automatically from src/core/processing/qgsprocessingparametertype.h
try:
QgsProcessingParameterType.__virtual_methods__ = ['pythonImportString', 'className', 'flags', 'metadata', 'acceptedPythonTypes', 'acceptedStringValues', 'acceptedDataTypes']
QgsProcessingParameterType.defaultModelColor = staticmethod(QgsProcessingParameterType.defaultModelColor)
QgsProcessingParameterType.__virtual_methods__ = ['pythonImportString', 'className', 'flags', 'metadata', 'acceptedPythonTypes', 'acceptedStringValues', 'acceptedDataTypes', 'modelColor']
QgsProcessingParameterType.__abstract_methods__ = ['create', 'description', 'name', 'id', 'acceptedParameterTypes', 'acceptedOutputTypes']
QgsProcessingParameterType.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -65,6 +65,13 @@ Constructor for QgsProcessingOutputDefinition.
virtual ~QgsProcessingOutputDefinition();
virtual QColor modelColor() const;
%Docstring
Returns the color to use for the output in model designer windows.
.. versionadded:: 4.0
%End
virtual QString type() const = 0;
%Docstring
Unique output type name.
@ -189,6 +196,9 @@ raster), use :py:class:`QgsProcessingOutputVectorLayer` or
Constructor for QgsProcessingOutputMapLayer.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -215,6 +225,9 @@ A vector layer output for processing algorithms.
Constructor for QgsProcessingOutputVectorLayer.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -257,6 +270,9 @@ Constructor for QgsProcessingOutputRasterLayer.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};
@ -316,8 +332,10 @@ Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -342,6 +360,9 @@ Constructor for QgsProcessingOutputHtml.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -370,6 +391,7 @@ Constructor for QgsProcessingOutputVariant.
%Docstring
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
@ -393,6 +415,9 @@ A numeric output for processing algorithms.
Constructor for QgsProcessingOutputNumber.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -423,6 +448,9 @@ Constructor for QgsProcessingOutputString.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};
@ -444,6 +472,9 @@ A boolean output for processing algorithms.
Constructor for :py:class:`QgsProcessingOutputNumber`.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -475,8 +506,10 @@ Constructor for QgsProcessingOutputFolder.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -501,8 +534,10 @@ Constructor for QgsProcessingOutputFile.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -554,6 +589,9 @@ Constructor for QgsProcessingOutputVectorTileLayer.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};

View File

@ -438,6 +438,27 @@ Constructor for QgsProcessingParameterDefinition.
virtual ~QgsProcessingParameterDefinition();
virtual QColor modelColor() const;
%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()`.
.. versionadded:: 4.0
%End
virtual QString userFriendlyString( const QVariant &value ) const;
%Docstring
Returns a user-friendly string representation of the provided parameter
``value``.
The returned string is to be used for display purposes only, and should
be translated as required.
.. versionadded:: 4.0
%End
virtual QgsProcessingParameterDefinition *clone() const = 0 /Factory/;
%Docstring
Creates a clone of the parameter definition.
@ -1994,6 +2015,9 @@ A coordinate reference system parameter for processing algorithms.
Constructor for QgsProcessingParameterCrs.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QString typeName();
%Docstring
Returns the type name for the parameter class.
@ -2167,6 +2191,7 @@ Sets the allow multipart geometries
.. seealso:: :py:func:`allowMultipart`
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
@ -2316,6 +2341,7 @@ Constructor for QgsProcessingParameterMatrix.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -2512,6 +2538,7 @@ Constructor for QgsProcessingParameterNumber.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -2620,6 +2647,9 @@ Constructor for QgsProcessingParameterDistance.
Returns the type name for the parameter class.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
virtual QgsProcessingParameterDistance *clone() const /Factory/;
@ -2758,6 +2788,8 @@ Sets the default area ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2848,6 +2880,8 @@ Sets the default volume ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2907,6 +2941,8 @@ Sets the default duration ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2977,6 +3013,7 @@ Constructor for QgsProcessingParameterRange.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -3106,6 +3143,9 @@ values.
Constructor for QgsProcessingParameterEnum.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QString typeName();
%Docstring
Returns the type name for the parameter class.
@ -4523,6 +4563,7 @@ varying color opacity.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -4861,6 +4902,8 @@ Sets the acceptable data ``type`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring

View File

@ -23,6 +23,13 @@ Makes metadata of processing parameters available.
%End
public:
static QColor defaultModelColor();
%Docstring
Returns the default color for a processing parameter.
.. versionadded:: 4.0
%End
virtual QgsProcessingParameterDefinition *create( const QString &name ) const = 0 /Factory/;
%Docstring
Creates a new parameter of this type.
@ -175,6 +182,16 @@ for the parameter.
.. seealso:: :py:func:`acceptedOutputTypes`
.. versionadded:: 3.44
%End
virtual QColor modelColor() const;
%Docstring
Returns the color to use for the parameter in model designer windows.
The default implementation returns
:py:func:`~QgsProcessingParameterType.defaultModelColor`.
.. versionadded:: 4.0
%End
};

View File

@ -16,7 +16,7 @@ QgsModelComponentGraphicItem.Flag.__and__ = lambda flag1, flag2: _force_int(flag
QgsModelComponentGraphicItem.Flag.__or__ = lambda flag1, flag2: QgsModelComponentGraphicItem.Flag(_force_int(flag1) | _force_int(flag2))
try:
QgsModelComponentGraphicItem.__attribute_docs__ = {'requestModelRepaint': 'Emitted by the item to request a repaint of the parent model scene.\n', 'aboutToChange': 'Emitted when the definition of the associated component is about to be\nchanged by the item.\n\nThe ``text`` argument gives the translated text describing the change\nabout to occur, and the optional ``id`` can be used to group the\nassociated undo commands.\n', 'changed': 'Emitted when the definition of the associated component is changed by\nthe item.\n', 'repaintArrows': 'Emitted when item requests that all connected arrows are repainted.\n', 'updateArrowPaths': 'Emitted when item requires that all connected arrow paths are\nrecalculated.\n', 'sizePositionChanged': "Emitted when the item's size or position changes.\n"}
QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap']
QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkedParameterDataType', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap']
QgsModelComponentGraphicItem.__abstract_methods__ = ['fillColor', 'strokeColor', 'textColor', 'updateStoredComponentPosition']
QgsModelComponentGraphicItem.__overridden_methods__ = ['mouseDoubleClickEvent', 'hoverEnterEvent', 'hoverMoveEvent', 'hoverLeaveEvent', 'itemChange', 'boundingRect', 'contains', 'paint']
QgsModelComponentGraphicItem.__signal_arguments__ = {'aboutToChange': ['text: str', 'id: int = 0']}
@ -30,7 +30,7 @@ try:
except (NameError, AttributeError):
pass
try:
QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent']
QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'linkedParameterDataType', 'linkColor', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent']
QgsModelParameterGraphicItem.__group__ = ['processing', 'models']
except (NameError, AttributeError):
pass

View File

@ -0,0 +1,18 @@
# The following has been generated automatically from src/gui/qgsshortcutsmanager.h
# monkey patching scoped based enum
QgsShortcutsManager.CommonAction.CodeToggleComment.__doc__ = "Toggle code comments"
QgsShortcutsManager.CommonAction.CodeReformat.__doc__ = "Reformat code"
QgsShortcutsManager.CommonAction.CodeRunScript.__doc__ = "Run script"
QgsShortcutsManager.CommonAction.CodeRunSelection.__doc__ = "Run selection from script"
QgsShortcutsManager.CommonAction.__doc__ = """Contains common actions which are used across a variety of classes.
.. versionadded:: 4.0
* ``CodeToggleComment``: Toggle code comments
* ``CodeReformat``: Reformat code
* ``CodeRunScript``: Run script
* ``CodeRunSelection``: Run selection from script
"""
# --
QgsShortcutsManager.CommonAction.baseClass = QgsShortcutsManager

View File

@ -112,6 +112,8 @@ Shows a preview of moving the item from its stored position by ``dx``,
Sets a new scene ``rect`` for the item.
%End
virtual QString linkedParameterDataType( Qt::Edge edge, int index ) const;
virtual void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event );
virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event );
@ -324,6 +326,13 @@ comment
Updates the item's button positions, based on the current item rect.
%End
QColor fallbackColor() const;
%Docstring
Returns the fallback color if the parameter or output does not have a
specific color.
.. versionadded:: 4.0
%End
};
QFlags<QgsModelComponentGraphicItem::Flag> operator|(QgsModelComponentGraphicItem::Flag f1, QFlags<QgsModelComponentGraphicItem::Flag> f2);
@ -362,6 +371,12 @@ Ownership of ``parameter`` is transferred to the item.
virtual bool canDeleteComponent();
virtual QString linkedParameterDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ) const;
virtual QColor linkColor( Qt::Edge edge, int index ) const;
protected:
virtual QColor fillColor( State state ) const;

View File

@ -182,6 +182,23 @@ 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
corresponds to.
.. versionadded:: 4.0
%End
bool isDefaultParameterValue() const;
%Docstring
Returns ``True`` if the parameter is set to the default parameter value.
.. versionadded:: 4.0
%End
signals:
};

View File

@ -23,6 +23,14 @@ rather accessed through :py:func:`QgsGui.shortcutsManager()`.
#include "qgsshortcutsmanager.h"
%End
public:
enum class CommonAction
{
CodeToggleComment,
CodeReformat,
CodeRunScript,
CodeRunSelection,
};
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
%Docstring
Constructor for QgsShortcutsManager.
@ -36,6 +44,8 @@ Constructor for QgsShortcutsManager.
QGIS actions.
%End
~QgsShortcutsManager();
void registerAllChildren( QObject *object, bool recursive = false, const QString &section = QString() );
%Docstring
Automatically registers all QActions and QShortcuts which are children
@ -105,6 +115,16 @@ in GUI.
.. seealso:: :py:func:`unregisterAction`
.. seealso:: :py:func:`registerAllChildActions`
%End
void initializeCommonAction( QAction *action, CommonAction commonAction );
%Docstring
Initializes an ``action`` as a common action.
This automatically configures the ``action`` to use the properties for
the common action, such as setting the action's tooltip and shortcut.
.. versionadded:: 4.0
%End
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString &section = QString() );
@ -290,6 +310,14 @@ if no shortcut is associated.
.. seealso:: :py:func:`objectForSequence`
.. seealso:: :py:func:`actionForSequence`
%End
QKeySequence sequenceForCommonAction( CommonAction action ) const;
%Docstring
Returns the key sequence which is associated with a common ``action``,
or an empty sequence if no shortcut is assigned to that action.
.. versionadded:: 4.0
%End
QAction *actionByName( const QString &name ) const;

View File

@ -6977,28 +6977,30 @@ QgsShapeburstFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwid
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L236
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L221
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L163
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L171
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L155
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L213
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L262
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L254
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L94
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L70
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L81
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L59
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L106
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L180
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L196
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L204
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L188
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L246
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L243
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L229
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L116
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L126
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L267
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L246
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L188
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L196
QgsShortcutsManager.initializeCommonAction: src/gui/qgsshortcutsmanager.h#L119
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L180
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L238
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L293
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L285
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L109
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L85
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L96
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L74
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L131
QgsShortcutsManager.sequenceForCommonAction: src/gui/qgsshortcutsmanager.h#L260
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L205
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L221
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L229
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L213
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L277
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L274
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L254
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L141
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L151
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271

View File

@ -19,5 +19,4 @@ __author__ = "Salvatore Larosa"
__date__ = "September 2012"
__copyright__ = "(C) 2012, Salvatore Larosa"
from .console import show_console # NOQA
from .console import init_options_widget
from .console import show_console, init_console # NOQA

View File

@ -61,6 +61,7 @@ from qgis.gui import (
QgsGui,
QgsApplicationExitBlockerInterface,
QgsCodeEditorDockWidget,
QgsShortcutsManager,
)
from functools import partial
@ -106,8 +107,11 @@ def console_displayhook(obj):
_console_output = obj
def init_options_widget():
"""called from QGIS to add the console options widget"""
def init_console():
"""
Called from QGIS to initialize the console related options and shortcuts,
before the dock is shown
"""
global _options_factory
_options_factory.setTitle(QCoreApplication.translate("PythonConsole", "Python"))
iface.registerOptionsWidgetFactory(_options_factory)
@ -221,169 +225,137 @@ class PythonConsoleWidget(QWidget):
# Action for Open File
openFileBt = QCoreApplication.translate("PythonConsole", "Open Script…")
self.openFileButton = QAction(self)
self.openFileButton.setCheckable(False)
self.openFileButton.setEnabled(True)
self.openFileButton.setIcon(
self.open_file_action = QAction(self)
self.open_file_action.setIcon(
QgsApplication.getThemeIcon("mActionScriptOpen.svg")
)
self.openFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.openFileButton.setIconVisibleInMenu(True)
self.openFileButton.setToolTip(openFileBt + " <b>Ctrl+O</b>")
self.openFileButton.setText(openFileBt)
self.open_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.open_file_action.setIconVisibleInMenu(True)
self.open_file_action.setToolTip(f"<b>{openFileBt}</b> (Ctrl+O)")
self.open_file_action.setText(openFileBt)
openExtEditorBt = QCoreApplication.translate(
"PythonConsole", "Open in External Editor"
)
self.openInEditorButton = QAction(self)
self.openInEditorButton.setCheckable(False)
self.openInEditorButton.setEnabled(True)
self.openInEditorButton.setIcon(
self.open_in_editor_action = QAction(self)
self.open_in_editor_action.setIcon(
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
)
self.openInEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.openInEditorButton.setIconVisibleInMenu(True)
self.openInEditorButton.setToolTip(openExtEditorBt)
self.openInEditorButton.setText(openExtEditorBt)
self.open_in_editor_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.open_in_editor_action.setIconVisibleInMenu(True)
self.open_in_editor_action.setToolTip(openExtEditorBt)
self.open_in_editor_action.setText(openExtEditorBt)
# Action for Save File
saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
self.saveFileButton = QAction(self)
self.saveFileButton.setCheckable(False)
self.saveFileButton.setEnabled(False)
self.saveFileButton.setIcon(QgsApplication.getThemeIcon("mActionFileSave.svg"))
self.saveFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.saveFileButton.setIconVisibleInMenu(True)
self.saveFileButton.setToolTip(saveFileBt + " <b>Ctrl+S</b>")
self.saveFileButton.setText(saveFileBt)
self.save_file_action = QAction(self)
self.save_file_action.setEnabled(False)
self.save_file_action.setIcon(
QgsApplication.getThemeIcon("mActionFileSave.svg")
)
self.save_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.save_file_action.setIconVisibleInMenu(True)
self.save_file_action.setToolTip(f"<b>{saveFileBt}</b> (Ctrl+S)")
self.save_file_action.setText(saveFileBt)
# Action for Save File As
saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As…")
self.saveAsFileButton = QAction(self)
self.saveAsFileButton.setCheckable(False)
self.saveAsFileButton.setEnabled(True)
self.saveAsFileButton.setIcon(
self.save_as_file_action = QAction(self)
self.save_as_file_action.setIcon(
QgsApplication.getThemeIcon("mActionFileSaveAs.svg")
)
self.saveAsFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.saveAsFileButton.setIconVisibleInMenu(True)
self.saveAsFileButton.setToolTip(saveAsFileBt + " <b>Ctrl+Shift+S</b>")
self.saveAsFileButton.setText(saveAsFileBt)
self.save_as_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.save_as_file_action.setIconVisibleInMenu(True)
self.save_as_file_action.setToolTip(f"<b>{saveAsFileBt}</b> (Ctrl+Shift+S)")
self.save_as_file_action.setText(saveAsFileBt)
# Action Cut
cutEditorBt = QCoreApplication.translate("PythonConsole", "Cut")
self.cutEditorButton = QAction(self)
self.cutEditorButton.setCheckable(False)
self.cutEditorButton.setEnabled(True)
self.cutEditorButton.setIcon(QgsApplication.getThemeIcon("mActionEditCut.svg"))
self.cutEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.cutEditorButton.setIconVisibleInMenu(True)
self.cutEditorButton.setToolTip(cutEditorBt + " <b>Ctrl+X</b>")
self.cutEditorButton.setText(cutEditorBt)
self.cut_action = QAction(self)
self.cut_action.setIcon(QgsApplication.getThemeIcon("mActionEditCut.svg"))
self.cut_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.cut_action.setIconVisibleInMenu(True)
self.cut_action.setToolTip(f"<b>{cutEditorBt}</b> (Ctrl+X)")
self.cut_action.setText(cutEditorBt)
# Action Copy
copyEditorBt = QCoreApplication.translate("PythonConsole", "Copy")
self.copyEditorButton = QAction(self)
self.copyEditorButton.setCheckable(False)
self.copyEditorButton.setEnabled(True)
self.copyEditorButton.setIcon(
QgsApplication.getThemeIcon("mActionEditCopy.svg")
)
self.copyEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.copyEditorButton.setIconVisibleInMenu(True)
self.copyEditorButton.setToolTip(copyEditorBt + " <b>Ctrl+C</b>")
self.copyEditorButton.setText(copyEditorBt)
self.copy_action = QAction(self)
self.copy_action.setIcon(QgsApplication.getThemeIcon("mActionEditCopy.svg"))
self.copy_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.copy_action.setIconVisibleInMenu(True)
self.copy_action.setToolTip(f"<b>{copyEditorBt}</b> (Ctrl+C)")
self.copy_action.setText(copyEditorBt)
# Action Paste
pasteEditorBt = QCoreApplication.translate("PythonConsole", "Paste")
self.pasteEditorButton = QAction(self)
self.pasteEditorButton.setCheckable(False)
self.pasteEditorButton.setEnabled(True)
self.pasteEditorButton.setIcon(
QgsApplication.getThemeIcon("mActionEditPaste.svg")
)
self.pasteEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.pasteEditorButton.setIconVisibleInMenu(True)
self.pasteEditorButton.setToolTip(pasteEditorBt + " <b>Ctrl+V</b>")
self.pasteEditorButton.setText(pasteEditorBt)
self.paste_action = QAction(self)
self.paste_action.setIcon(QgsApplication.getThemeIcon("mActionEditPaste.svg"))
self.paste_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.paste_action.setIconVisibleInMenu(True)
self.paste_action.setToolTip(f"<b>{pasteEditorBt}</b> (Ctrl+V)")
self.paste_action.setText(pasteEditorBt)
# Action Run Script (subprocess)
runScriptEditorBt = QCoreApplication.translate("PythonConsole", "Run Script")
self.runScriptEditorButton = QAction(self)
self.runScriptEditorButton.setCheckable(False)
self.runScriptEditorButton.setEnabled(True)
self.runScriptEditorButton.setIcon(
QgsApplication.getThemeIcon("mActionStart.svg")
self.run_script_action = QAction(self)
self.run_script_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
self.run_script_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.run_script_action.setIconVisibleInMenu(True)
QgsGui.shortcutsManager().initializeCommonAction(
self.run_script_action, QgsShortcutsManager.CommonAction.CodeRunScript
)
self.runScriptEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.runScriptEditorButton.setIconVisibleInMenu(True)
self.runScriptEditorButton.setToolTip(
runScriptEditorBt + " <b>Ctrl+Shift+E</b>"
)
self.runScriptEditorButton.setText(runScriptEditorBt)
# Action Run Selected
runSelectedEditorBt = QCoreApplication.translate(
"PythonConsole", "Run Selected"
)
self.runSelectedEditorButton = QAction(self)
self.runSelectedEditorButton.setCheckable(False)
self.runSelectedEditorButton.setEnabled(True)
self.runSelectedEditorButton.setIcon(
self.run_selection_action = QAction(self)
self.run_selection_action.setIcon(
QgsApplication.getThemeIcon("mActionRunSelected.svg")
)
self.runSelectedEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.runSelectedEditorButton.setIconVisibleInMenu(True)
self.runSelectedEditorButton.setToolTip(runSelectedEditorBt + " <b>Ctrl+E</b>")
self.runSelectedEditorButton.setShortcut("Ctrl+E")
self.runSelectedEditorButton.setText(runSelectedEditorBt)
self.run_selection_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.run_selection_action.setIconVisibleInMenu(True)
QgsGui.shortcutsManager().initializeCommonAction(
self.run_selection_action, QgsShortcutsManager.CommonAction.CodeRunSelection
)
# Action Toggle comment
toggleText = QCoreApplication.translate("PythonConsole", "Toggle Comment")
self.toggleCommentEditorButton = QAction(self)
self.toggleCommentEditorButton.setCheckable(False)
self.toggleCommentEditorButton.setEnabled(True)
self.toggleCommentEditorButton.setIcon(
self.toggle_comment_action = QAction(self)
self.toggle_comment_action.setIcon(
QgsApplication.getThemeIcon(
"console/iconCommentEditorConsole.svg",
self.palette().color(QPalette.ColorRole.WindowText),
),
)
self.toggleCommentEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.toggleCommentEditorButton.setIconVisibleInMenu(True)
self.toggleCommentEditorButton.setToolTip(toggleText + " <b>Ctrl+:</b>")
self.toggleCommentEditorButton.setText(toggleText)
self.toggle_comment_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.toggle_comment_action.setIconVisibleInMenu(True)
QgsGui.shortcutsManager().initializeCommonAction(
self.toggle_comment_action,
QgsShortcutsManager.CommonAction.CodeToggleComment,
)
# Action Format code
reformatCodeText = QCoreApplication.translate("PythonConsole", "Reformat Code")
self.reformatCodeEditorButton = QAction(self)
self.reformatCodeEditorButton.setCheckable(False)
self.reformatCodeEditorButton.setEnabled(True)
self.reformatCodeEditorButton.setIcon(
self.reformat_code_action = QAction(self)
self.reformat_code_action.setIcon(
QgsApplication.getThemeIcon("console/iconFormatCode.svg")
)
self.reformatCodeEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.reformatCodeEditorButton.setIconVisibleInMenu(True)
self.reformatCodeEditorButton.setToolTip(
reformatCodeText + " <b>Ctrl+Alt+F</b>"
self.reformat_code_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.reformat_code_action.setIconVisibleInMenu(True)
QgsGui.shortcutsManager().initializeCommonAction(
self.reformat_code_action, QgsShortcutsManager.CommonAction.CodeReformat
)
self.reformatCodeEditorButton.setShortcut("Ctrl+Alt+F")
self.reformatCodeEditorButton.setText(reformatCodeText)
# Action for Object browser
objList = QCoreApplication.translate("PythonConsole", "Object Inspector…")
self.objectListButton = QAction(self)
self.objectListButton.setCheckable(True)
self.objectListButton.setEnabled(
self.object_inspector_action = QAction(self)
self.object_inspector_action.setCheckable(True)
self.object_inspector_action.setEnabled(
QgsSettings().value("pythonConsole/enableObjectInsp", False, type=bool)
)
self.objectListButton.setIcon(
self.object_inspector_action.setIcon(
QgsApplication.getThemeIcon("console/iconClassBrowserConsole.svg")
)
self.objectListButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.objectListButton.setIconVisibleInMenu(True)
self.objectListButton.setToolTip(objList)
self.objectListButton.setText(objList)
self.object_inspector_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.object_inspector_action.setIconVisibleInMenu(True)
self.object_inspector_action.setToolTip(objList)
self.object_inspector_action.setText(objList)
# Action for Find text
findText = QCoreApplication.translate("PythonConsole", "Find Text")
@ -395,7 +367,7 @@ class PythonConsoleWidget(QWidget):
)
self.find_text_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.find_text_action.setIconVisibleInMenu(True)
self.find_text_action.setToolTip(findText + " <b>Ctrl+F</b>")
self.find_text_action.setToolTip(f"<b>{findText}</b> (Ctrl+F)")
self.find_text_action.setText(findText)
self.tabEditorWidget.search_bar_toggled.connect(
@ -407,75 +379,65 @@ class PythonConsoleWidget(QWidget):
# Action Show Editor
showEditor = QCoreApplication.translate("PythonConsole", "Show Editor")
self.showEditorButton = QAction(self)
self.showEditorButton.setEnabled(True)
self.showEditorButton.setCheckable(True)
self.showEditorButton.setIcon(
self.show_editor_action = QAction(self)
self.show_editor_action.setCheckable(True)
self.show_editor_action.setIcon(
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
)
self.showEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.showEditorButton.setIconVisibleInMenu(True)
self.showEditorButton.setToolTip(showEditor)
self.showEditorButton.setText(showEditor)
self.show_editor_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.show_editor_action.setIconVisibleInMenu(True)
self.show_editor_action.setToolTip(showEditor)
self.show_editor_action.setText(showEditor)
# Action for Clear button
clearBt = QCoreApplication.translate("PythonConsole", "Clear Console")
self.clearButton = QAction(self)
self.clearButton.setCheckable(False)
self.clearButton.setEnabled(True)
self.clearButton.setIcon(
self.clear_action = QAction(self)
self.clear_action.setIcon(
QgsApplication.getThemeIcon("console/iconClearConsole.svg")
)
self.clearButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.clearButton.setIconVisibleInMenu(True)
self.clearButton.setToolTip(clearBt)
self.clearButton.setText(clearBt)
self.clear_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.clear_action.setIconVisibleInMenu(True)
self.clear_action.setToolTip(clearBt)
self.clear_action.setText(clearBt)
# Action for settings
optionsBt = QCoreApplication.translate("PythonConsole", "Options…")
self.optionsButton = QAction(self)
self.optionsButton.setCheckable(False)
self.optionsButton.setEnabled(True)
self.optionsButton.setIcon(
self.options_action = QAction(self)
self.options_action.setIcon(
QgsApplication.getThemeIcon("console/iconSettingsConsole.svg")
)
self.optionsButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.optionsButton.setIconVisibleInMenu(True)
self.optionsButton.setToolTip(optionsBt)
self.optionsButton.setText(optionsBt)
self.options_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.options_action.setIconVisibleInMenu(True)
self.options_action.setToolTip(optionsBt)
self.options_action.setText(optionsBt)
# Action for Run script
runBt = QCoreApplication.translate("PythonConsole", "Run Command")
self.runButton = QAction(self)
self.runButton.setCheckable(False)
self.runButton.setEnabled(True)
self.runButton.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
self.runButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.runButton.setIconVisibleInMenu(True)
self.runButton.setToolTip(runBt)
self.runButton.setText(runBt)
self.run_action = QAction(self)
self.run_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
self.run_action.setMenuRole(QAction.MenuRole.PreferencesRole)
self.run_action.setIconVisibleInMenu(True)
self.run_action.setToolTip(runBt)
self.run_action.setText(runBt)
# Help button
self.helpConsoleAction = QAction(self)
self.helpConsoleAction.setEnabled(True)
self.helpConsoleAction.setText(
self.help_console_action = QAction(self)
self.help_console_action.setText(
QCoreApplication.translate("PythonConsole", "Python Console Help")
)
self.helpAPIAction = QAction(self)
self.helpAPIAction.setEnabled(True)
self.helpAPIAction.setText(
self.help_api_action = QAction(self)
self.help_api_action.setText(
QCoreApplication.translate("PythonConsole", "PyQGIS API Documentation")
)
self.helpCookbookAction = QAction(self)
self.helpCookbookAction.setEnabled(True)
self.helpCookbookAction.setText(
self.help_cookbook_action = QAction(self)
self.help_cookbook_action.setText(
QCoreApplication.translate("PythonConsole", "PyQGIS Cookbook")
)
self.helpMenu = QMenu(self)
self.helpMenu.addAction(self.helpConsoleAction)
self.helpMenu.addAction(self.helpAPIAction)
self.helpMenu.addAction(self.helpCookbookAction)
self.helpMenu.addAction(self.help_console_action)
self.helpMenu.addAction(self.help_api_action)
self.helpMenu.addAction(self.help_cookbook_action)
helpBt = QCoreApplication.translate("PythonConsole", "Help…")
self.helpButton = QToolButton(self)
@ -495,12 +457,12 @@ class PythonConsoleWidget(QWidget):
self.toolBar.setIconSize(icon_size)
self.toolBar.setMovable(False)
self.toolBar.setFloatable(False)
self.toolBar.addAction(self.clearButton)
self.toolBar.addAction(self.runButton)
self.toolBar.addAction(self.clear_action)
self.toolBar.addAction(self.run_action)
self.toolBar.addSeparator()
self.toolBar.addAction(self.showEditorButton)
self.toolBar.addAction(self.show_editor_action)
self.toolBar.addSeparator()
self.toolBar.addAction(self.optionsButton)
self.toolBar.addAction(self.options_action)
self.toolBar.addWidget(self.helpButton)
self.toolBar.addSeparator()
self.toolBar.addWidget(parent.dockToggleButton())
@ -513,25 +475,25 @@ class PythonConsoleWidget(QWidget):
self.toolBarEditor.setIconSize(icon_size)
self.toolBarEditor.setMovable(False)
self.toolBarEditor.setFloatable(False)
self.toolBarEditor.addAction(self.openFileButton)
self.toolBarEditor.addAction(self.openInEditorButton)
self.toolBarEditor.addAction(self.open_file_action)
self.toolBarEditor.addAction(self.open_in_editor_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.saveFileButton)
self.toolBarEditor.addAction(self.saveAsFileButton)
self.toolBarEditor.addAction(self.save_file_action)
self.toolBarEditor.addAction(self.save_as_file_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.runScriptEditorButton)
self.toolBarEditor.addAction(self.runSelectedEditorButton)
self.toolBarEditor.addAction(self.run_script_action)
self.toolBarEditor.addAction(self.run_selection_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.cutEditorButton)
self.toolBarEditor.addAction(self.copyEditorButton)
self.toolBarEditor.addAction(self.pasteEditorButton)
self.toolBarEditor.addAction(self.cut_action)
self.toolBarEditor.addAction(self.copy_action)
self.toolBarEditor.addAction(self.paste_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.find_text_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.toggleCommentEditorButton)
self.toolBarEditor.addAction(self.reformatCodeEditorButton)
self.toolBarEditor.addAction(self.toggle_comment_action)
self.toolBarEditor.addAction(self.reformat_code_action)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.objectListButton)
self.toolBarEditor.addAction(self.object_inspector_action)
self.widgetButton = QWidget()
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred)
@ -585,25 +547,25 @@ class PythonConsoleWidget(QWidget):
# ------------ Signal -------------------------------
self.objectListButton.toggled.connect(self.toggleObjectListWidget)
self.toggleCommentEditorButton.triggered.connect(self.toggleComment)
self.reformatCodeEditorButton.triggered.connect(self.reformatCode)
self.runScriptEditorButton.triggered.connect(self.runScriptEditor)
self.runSelectedEditorButton.triggered.connect(self.runSelectedEditor)
self.cutEditorButton.triggered.connect(self.cutEditor)
self.copyEditorButton.triggered.connect(self.copyEditor)
self.pasteEditorButton.triggered.connect(self.pasteEditor)
self.showEditorButton.toggled.connect(self.toggleEditor)
self.clearButton.triggered.connect(self.shell_output.clearConsole)
self.optionsButton.triggered.connect(self.openSettings)
self.runButton.triggered.connect(self.shell.entered)
self.openFileButton.triggered.connect(self.openScriptFile)
self.openInEditorButton.triggered.connect(self.openScriptFileExtEditor)
self.saveFileButton.triggered.connect(self.saveScriptFile)
self.saveAsFileButton.triggered.connect(self.saveAsScriptFile)
self.helpConsoleAction.triggered.connect(self.openHelpConsole)
self.helpAPIAction.triggered.connect(self.openHelpAPI)
self.helpCookbookAction.triggered.connect(self.openHelpCookbook)
self.object_inspector_action.toggled.connect(self.toggleObjectListWidget)
self.toggle_comment_action.triggered.connect(self.toggleComment)
self.reformat_code_action.triggered.connect(self.reformatCode)
self.run_script_action.triggered.connect(self.runScriptEditor)
self.run_selection_action.triggered.connect(self.runSelectedEditor)
self.cut_action.triggered.connect(self.cutEditor)
self.copy_action.triggered.connect(self.copyEditor)
self.paste_action.triggered.connect(self.pasteEditor)
self.show_editor_action.toggled.connect(self.toggleEditor)
self.clear_action.triggered.connect(self.shell_output.clearConsole)
self.options_action.triggered.connect(self.openSettings)
self.run_action.triggered.connect(self.shell.entered)
self.open_file_action.triggered.connect(self.openScriptFile)
self.open_in_editor_action.triggered.connect(self.openScriptFileExtEditor)
self.save_file_action.triggered.connect(self.saveScriptFile)
self.save_as_file_action.triggered.connect(self.saveAsScriptFile)
self.help_console_action.triggered.connect(self.openHelpConsole)
self.help_api_action.triggered.connect(self.openHelpAPI)
self.help_cookbook_action.triggered.connect(self.openHelpCookbook)
self.listClassMethod.itemClicked.connect(self.onClickGoToLine)
if iface is not None:

View File

@ -33,7 +33,13 @@ from operator import itemgetter
from pathlib import Path
from qgis.core import Qgis, QgsApplication, QgsBlockingNetworkRequest, QgsSettings
from qgis.gui import QgsCodeEditorPython, QgsCodeEditorWidget, QgsMessageBar
from qgis.gui import (
QgsCodeEditorPython,
QgsCodeEditorWidget,
QgsGui,
QgsMessageBar,
QgsShortcutsManager,
)
from qgis.PyQt.Qsci import QsciScintilla
from qgis.PyQt.QtCore import (
@ -159,15 +165,6 @@ class Editor(QgsCodeEditorPython):
syntaxCheckAction.setShortcut("Ctrl+4")
menu.addAction(syntaxCheckAction)
runSelected = QAction(
QgsApplication.getThemeIcon("mActionRunSelected.svg"), # spellok
QCoreApplication.translate("PythonConsole", "Run Selected"),
menu,
)
runSelected.triggered.connect(self.runSelectedCode) # spellok
runSelected.setShortcut("Ctrl+E") # spellok
menu.addAction(runSelected) # spellok
word = self.selectedText() or self.wordAtPoint(e.pos())
if word:
context_help_action = QAction(
@ -185,13 +182,24 @@ class Editor(QgsCodeEditorPython):
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
menu.addAction(context_help_action)
start_action = QAction(
QgsApplication.getThemeIcon("mActionStart.svg"),
QCoreApplication.translate("PythonConsole", "Run Script"),
menu,
run_selection_action = QAction(menu)
run_selection_action.setIcon(
QgsApplication.getThemeIcon("mActionRunSelected.svg"),
)
run_selection_action.triggered.connect(self.runSelectedCode)
QgsGui.shortcutsManager().initializeCommonAction(
run_selection_action,
QgsShortcutsManager.CommonAction.CodeRunSelection,
)
menu.addAction(run_selection_action)
start_action = QAction(self)
start_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
start_action.triggered.connect(self.runScriptCode)
start_action.setShortcut("Ctrl+Shift+E")
QgsGui.shortcutsManager().initializeCommonAction(
start_action,
QgsShortcutsManager.CommonAction.CodeRunScript,
)
menu.addAction(start_action)
menu.addSeparator()
@ -258,18 +266,31 @@ class Editor(QgsCodeEditorPython):
menu.addAction(selectAllAction)
menu.addSeparator()
toggle_comment_action = QAction(
toggle_comment_action = QAction(menu)
toggle_comment_action.setIcon(
QgsApplication.getThemeIcon(
"console/iconCommentEditorConsole.svg",
self.palette().color(QPalette.ColorRole.WindowText),
),
QCoreApplication.translate("PythonConsole", "Toggle Comment"),
menu,
)
)
toggle_comment_action.triggered.connect(self.toggleComment)
toggle_comment_action.setShortcut("Ctrl+:")
QgsGui.shortcutsManager().initializeCommonAction(
toggle_comment_action,
QgsShortcutsManager.CommonAction.CodeToggleComment,
)
menu.addAction(toggle_comment_action)
reformat_code_action = QAction(menu)
reformat_code_action.setIcon(
QgsApplication.getThemeIcon("console/iconFormatCode.svg")
)
reformat_code_action.triggered.connect(self.reformatCode)
QgsGui.shortcutsManager().initializeCommonAction(
reformat_code_action,
QgsShortcutsManager.CommonAction.CodeReformat,
)
menu.addAction(reformat_code_action)
menu.addSeparator()
gist_menu = QMenu(self)
gist_menu.setTitle(
@ -299,14 +320,14 @@ class Editor(QgsCodeEditorPython):
syntaxCheckAction.setEnabled(False)
pasteAction.setEnabled(False)
cutAction.setEnabled(False)
runSelected.setEnabled(False) # spellok
run_selection_action.setEnabled(False)
copyAction.setEnabled(False)
selectAllAction.setEnabled(False)
undoAction.setEnabled(False)
redoAction.setEnabled(False)
showCodeInspection.setEnabled(False)
if self.hasSelectedText():
runSelected.setEnabled(True) # spellok
run_selection_action.setEnabled(True)
copyAction.setEnabled(True)
cutAction.setEnabled(True)
if not self.text() == "":
@ -326,17 +347,17 @@ class Editor(QgsCodeEditorPython):
listObj = self.console_widget.listClassMethod
if listObj.isVisible():
listObj.hide()
self.console_widget.objectListButton.setChecked(False)
self.console_widget.object_inspector_action.setChecked(False)
else:
listObj.show()
self.console_widget.objectListButton.setChecked(True)
self.console_widget.object_inspector_action.setChecked(True)
def shareOnGist(self, is_public):
self.code_editor_widget.shareOnGist(is_public)
def hideEditor(self):
self.console_widget.splitterObj.hide()
self.console_widget.showEditorButton.setChecked(False)
self.console_widget.show_editor_action.setChecked(False)
def createTempFile(self):
name = tempfile.NamedTemporaryFile(delete=False).name
@ -475,7 +496,7 @@ class Editor(QgsCodeEditorPython):
)
self.tab_widget.setTabToolTip(index, self.code_editor_widget.filePath())
self.setModified(False)
self.console_widget.saveFileButton.setEnabled(False)
self.console_widget.save_file_action.setEnabled(False)
self.console_widget.updateTabListScript(
self.code_editor_widget.filePath(), action="append"
)
@ -720,7 +741,7 @@ class EditorTabWidget(QTabWidget):
# New Editor button
self.newTabButton = QToolButton()
txtToolTipNewTab = QCoreApplication.translate("PythonConsole", "New Editor")
self.newTabButton.setToolTip(txtToolTipNewTab + " <b>Ctrl+T</b>")
self.newTabButton.setToolTip(f"<b>{txtToolTipNewTab}</b> (Ctrl+T)")
self.newTabButton.setAutoRaise(True)
self.newTabButton.setIcon(
QgsApplication.getThemeIcon("console/iconNewTabEditorConsole.svg")
@ -810,7 +831,7 @@ class EditorTabWidget(QTabWidget):
def enableSaveIfModified(self, tab):
tabWidget = self.widget(tab)
if tabWidget:
self.console_widget.saveFileButton.setEnabled(tabWidget.isModified())
self.console_widget.save_file_action.setEnabled(tabWidget.isModified())
def enableToolBarEditor(self, enable):
if self.topFrame.isVisible():
@ -864,7 +885,7 @@ class EditorTabWidget(QTabWidget):
index = self.indexOf(tab)
s = self.tabText(index)
self.setTabTitle(index, f"*{s}" if modified else re.sub(r"^(\*)", "", s))
self.console_widget.saveFileButton.setEnabled(modified)
self.console_widget.save_file_action.setEnabled(modified)
def setTabTitle(self, tab, title):
self.setTabText(tab, title)
@ -1071,10 +1092,9 @@ class EditorTabWidget(QTabWidget):
objInspectorEnabled = QgsSettings().value(
"pythonConsole/enableObjectInsp", False, type=bool
)
listObj = self.console_widget.objectListButton
if self.console_widget.listClassMethod.isVisible():
listObj.setChecked(objInspectorEnabled)
listObj.setEnabled(objInspectorEnabled)
self.console_widget.object_inspector_action.setChecked(objInspectorEnabled)
self.console_widget.object_inspector_action.setEnabled(objInspectorEnabled)
if objInspectorEnabled:
cW = self.currentWidget()
if cW and not self.console_widget.listClassMethod.isVisible():

View File

@ -348,7 +348,7 @@ class ShellOutputScintilla(QgsCodeEditorPython):
Ed = self.console_widget.splitterObj
if not Ed.isVisible():
Ed.show()
self.console_widget.showEditorButton.setChecked(True)
self.console_widget.show_editor_action.setChecked(True)
self.shell_editor.setFocus()
def copy(self):

View File

@ -1,19 +1,19 @@
# The following has been generated automatically from src/core/processing/qgsprocessingoutputs.h
try:
QgsProcessingOutputMapLayer.typeName = staticmethod(QgsProcessingOutputMapLayer.typeName)
QgsProcessingOutputMapLayer.__overridden_methods__ = ['type']
QgsProcessingOutputMapLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputMapLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputVectorLayer.typeName = staticmethod(QgsProcessingOutputVectorLayer.typeName)
QgsProcessingOutputVectorLayer.__overridden_methods__ = ['type']
QgsProcessingOutputVectorLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputVectorLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputRasterLayer.typeName = staticmethod(QgsProcessingOutputRasterLayer.typeName)
QgsProcessingOutputRasterLayer.__overridden_methods__ = ['type']
QgsProcessingOutputRasterLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputRasterLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -25,13 +25,13 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputMultipleLayers.typeName = staticmethod(QgsProcessingOutputMultipleLayers.typeName)
QgsProcessingOutputMultipleLayers.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputMultipleLayers.__overridden_methods__ = ['type', 'modelColor', 'valueAsString']
QgsProcessingOutputMultipleLayers.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputHtml.typeName = staticmethod(QgsProcessingOutputHtml.typeName)
QgsProcessingOutputHtml.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputHtml.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputHtml.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -43,31 +43,31 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputNumber.typeName = staticmethod(QgsProcessingOutputNumber.typeName)
QgsProcessingOutputNumber.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputNumber.__overridden_methods__ = ['modelColor', 'type', 'valueAsString']
QgsProcessingOutputNumber.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputString.typeName = staticmethod(QgsProcessingOutputString.typeName)
QgsProcessingOutputString.__overridden_methods__ = ['type']
QgsProcessingOutputString.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputString.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputBoolean.typeName = staticmethod(QgsProcessingOutputBoolean.typeName)
QgsProcessingOutputBoolean.__overridden_methods__ = ['type', 'valueAsString']
QgsProcessingOutputBoolean.__overridden_methods__ = ['modelColor', 'type', 'valueAsString']
QgsProcessingOutputBoolean.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputFolder.typeName = staticmethod(QgsProcessingOutputFolder.typeName)
QgsProcessingOutputFolder.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputFolder.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputFolder.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputFile.typeName = staticmethod(QgsProcessingOutputFile.typeName)
QgsProcessingOutputFile.__overridden_methods__ = ['type', 'valueAsFormattedString']
QgsProcessingOutputFile.__overridden_methods__ = ['type', 'modelColor', 'valueAsFormattedString']
QgsProcessingOutputFile.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -79,12 +79,12 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingOutputVectorTileLayer.typeName = staticmethod(QgsProcessingOutputVectorTileLayer.typeName)
QgsProcessingOutputVectorTileLayer.__overridden_methods__ = ['type']
QgsProcessingOutputVectorTileLayer.__overridden_methods__ = ['modelColor', 'type']
QgsProcessingOutputVectorTileLayer.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingOutputDefinition.__virtual_methods__ = ['valueAsString', 'valueAsFormattedString']
QgsProcessingOutputDefinition.__virtual_methods__ = ['modelColor', 'valueAsString', 'valueAsFormattedString']
QgsProcessingOutputDefinition.__abstract_methods__ = ['type']
QgsProcessingOutputDefinition.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -82,7 +82,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterCrs.typeName = staticmethod(QgsProcessingParameterCrs.typeName)
QgsProcessingParameterCrs.fromScriptCode = staticmethod(QgsProcessingParameterCrs.fromScriptCode)
QgsProcessingParameterCrs.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsString', 'valueAsJsonObject']
QgsProcessingParameterCrs.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsString', 'valueAsJsonObject']
QgsProcessingParameterCrs.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -103,7 +103,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterGeometry.typeName = staticmethod(QgsProcessingParameterGeometry.typeName)
QgsProcessingParameterGeometry.fromScriptCode = staticmethod(QgsProcessingParameterGeometry.fromScriptCode)
QgsProcessingParameterGeometry.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterGeometry.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterGeometry.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -137,25 +137,25 @@ except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDistance.typeName = staticmethod(QgsProcessingParameterDistance.typeName)
QgsProcessingParameterDistance.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDistance.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDistance.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterArea.typeName = staticmethod(QgsProcessingParameterArea.typeName)
QgsProcessingParameterArea.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterArea.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterArea.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterVolume.typeName = staticmethod(QgsProcessingParameterVolume.typeName)
QgsProcessingParameterVolume.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterVolume.__overridden_methods__ = ['clone', 'type', 'dependsOnOtherParameters', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterVolume.__group__ = ['processing']
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDuration.typeName = staticmethod(QgsProcessingParameterDuration.typeName)
QgsProcessingParameterDuration.__overridden_methods__ = ['clone', 'type', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDuration.__overridden_methods__ = ['clone', 'type', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterDuration.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -183,7 +183,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterEnum.typeName = staticmethod(QgsProcessingParameterEnum.typeName)
QgsProcessingParameterEnum.fromScriptCode = staticmethod(QgsProcessingParameterEnum.fromScriptCode)
QgsProcessingParameterEnum.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterEnum.__overridden_methods__ = ['userFriendlyString', 'clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterEnum.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -326,7 +326,7 @@ except (NameError, AttributeError):
try:
QgsProcessingParameterDateTime.typeName = staticmethod(QgsProcessingParameterDateTime.typeName)
QgsProcessingParameterDateTime.fromScriptCode = staticmethod(QgsProcessingParameterDateTime.fromScriptCode)
QgsProcessingParameterDateTime.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'toolTip', 'asPythonString', 'toVariantMap', 'fromVariantMap']
QgsProcessingParameterDateTime.__overridden_methods__ = ['clone', 'type', 'checkValueIsAcceptable', 'valueAsPythonString', 'toolTip', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'userFriendlyString']
QgsProcessingParameterDateTime.__group__ = ['processing']
except (NameError, AttributeError):
pass
@ -389,7 +389,7 @@ try:
except (NameError, AttributeError):
pass
try:
QgsProcessingParameterDefinition.__virtual_methods__ = ['isDestination', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsJsonObject', 'valueAsString', 'valueAsStringList', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'dependsOnOtherParameters', 'toolTip']
QgsProcessingParameterDefinition.__virtual_methods__ = ['modelColor', 'userFriendlyString', 'isDestination', 'checkValueIsAcceptable', 'valueAsPythonString', 'valueAsJsonObject', 'valueAsString', 'valueAsStringList', 'valueAsPythonComment', 'asScriptCode', 'asPythonString', 'toVariantMap', 'fromVariantMap', 'dependsOnOtherParameters', 'toolTip']
QgsProcessingParameterDefinition.__abstract_methods__ = ['clone', 'type']
QgsProcessingParameterDefinition.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -1,6 +1,7 @@
# The following has been generated automatically from src/core/processing/qgsprocessingparametertype.h
try:
QgsProcessingParameterType.__virtual_methods__ = ['pythonImportString', 'className', 'flags', 'metadata', 'acceptedPythonTypes', 'acceptedStringValues', 'acceptedDataTypes']
QgsProcessingParameterType.defaultModelColor = staticmethod(QgsProcessingParameterType.defaultModelColor)
QgsProcessingParameterType.__virtual_methods__ = ['pythonImportString', 'className', 'flags', 'metadata', 'acceptedPythonTypes', 'acceptedStringValues', 'acceptedDataTypes', 'modelColor']
QgsProcessingParameterType.__abstract_methods__ = ['create', 'description', 'name', 'id', 'acceptedParameterTypes', 'acceptedOutputTypes']
QgsProcessingParameterType.__group__ = ['processing']
except (NameError, AttributeError):

View File

@ -65,6 +65,13 @@ Constructor for QgsProcessingOutputDefinition.
virtual ~QgsProcessingOutputDefinition();
virtual QColor modelColor() const;
%Docstring
Returns the color to use for the output in model designer windows.
.. versionadded:: 4.0
%End
virtual QString type() const = 0;
%Docstring
Unique output type name.
@ -189,6 +196,9 @@ raster), use :py:class:`QgsProcessingOutputVectorLayer` or
Constructor for QgsProcessingOutputMapLayer.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -215,6 +225,9 @@ A vector layer output for processing algorithms.
Constructor for QgsProcessingOutputVectorLayer.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -257,6 +270,9 @@ Constructor for QgsProcessingOutputRasterLayer.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};
@ -316,8 +332,10 @@ Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -342,6 +360,9 @@ Constructor for QgsProcessingOutputHtml.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -370,6 +391,7 @@ Constructor for QgsProcessingOutputVariant.
%Docstring
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
@ -393,6 +415,9 @@ A numeric output for processing algorithms.
Constructor for QgsProcessingOutputNumber.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -423,6 +448,9 @@ Constructor for QgsProcessingOutputString.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};
@ -444,6 +472,9 @@ A boolean output for processing algorithms.
Constructor for :py:class:`QgsProcessingOutputNumber`.
%End
virtual QColor modelColor() const;
static QString typeName();
%Docstring
Returns the type name for the output class.
@ -475,8 +506,10 @@ Constructor for QgsProcessingOutputFolder.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -501,8 +534,10 @@ Constructor for QgsProcessingOutputFile.
Returns the type name for the output class.
%End
virtual QString type() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
virtual QColor modelColor() const;
virtual QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok /Out/ ) const;
};
@ -554,6 +589,9 @@ Constructor for QgsProcessingOutputVectorTileLayer.
%Docstring
Returns the type name for the output class.
%End
virtual QColor modelColor() const;
virtual QString type() const;
};

View File

@ -438,6 +438,27 @@ Constructor for QgsProcessingParameterDefinition.
virtual ~QgsProcessingParameterDefinition();
virtual QColor modelColor() const;
%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()`.
.. versionadded:: 4.0
%End
virtual QString userFriendlyString( const QVariant &value ) const;
%Docstring
Returns a user-friendly string representation of the provided parameter
``value``.
The returned string is to be used for display purposes only, and should
be translated as required.
.. versionadded:: 4.0
%End
virtual QgsProcessingParameterDefinition *clone() const = 0 /Factory/;
%Docstring
Creates a clone of the parameter definition.
@ -1994,6 +2015,9 @@ A coordinate reference system parameter for processing algorithms.
Constructor for QgsProcessingParameterCrs.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QString typeName();
%Docstring
Returns the type name for the parameter class.
@ -2167,6 +2191,7 @@ Sets the allow multipart geometries
.. seealso:: :py:func:`allowMultipart`
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QgsProcessingParameterGeometry *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
@ -2316,6 +2341,7 @@ Constructor for QgsProcessingParameterMatrix.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -2512,6 +2538,7 @@ Constructor for QgsProcessingParameterNumber.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -2620,6 +2647,9 @@ Constructor for QgsProcessingParameterDistance.
Returns the type name for the parameter class.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
virtual QgsProcessingParameterDistance *clone() const /Factory/;
@ -2758,6 +2788,8 @@ Sets the default area ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2848,6 +2880,8 @@ Sets the default volume ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2907,6 +2941,8 @@ Sets the default duration ``unit`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
};
@ -2977,6 +3013,7 @@ Constructor for QgsProcessingParameterRange.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -3106,6 +3143,9 @@ values.
Constructor for QgsProcessingParameterEnum.
%End
virtual QString userFriendlyString( const QVariant &value ) const;
static QString typeName();
%Docstring
Returns the type name for the parameter class.
@ -4523,6 +4563,7 @@ varying color opacity.
%Docstring
Returns the type name for the parameter class.
%End
virtual QgsProcessingParameterDefinition *clone() const /Factory/;
virtual QString type() const;
@ -4861,6 +4902,8 @@ Sets the acceptable data ``type`` for the parameter.
virtual bool fromVariantMap( const QVariantMap &map );
virtual QString userFriendlyString( const QVariant &value ) const;
static QgsProcessingParameterDateTime *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) /Factory/;
%Docstring

View File

@ -23,6 +23,13 @@ Makes metadata of processing parameters available.
%End
public:
static QColor defaultModelColor();
%Docstring
Returns the default color for a processing parameter.
.. versionadded:: 4.0
%End
virtual QgsProcessingParameterDefinition *create( const QString &name ) const = 0 /Factory/;
%Docstring
Creates a new parameter of this type.
@ -175,6 +182,16 @@ for the parameter.
.. seealso:: :py:func:`acceptedOutputTypes`
.. versionadded:: 3.44
%End
virtual QColor modelColor() const;
%Docstring
Returns the color to use for the parameter in model designer windows.
The default implementation returns
:py:func:`~QgsProcessingParameterType.defaultModelColor`.
.. versionadded:: 4.0
%End
};

View File

@ -1,7 +1,7 @@
# The following has been generated automatically from src/gui/processing/models/qgsmodelcomponentgraphicitem.h
try:
QgsModelComponentGraphicItem.__attribute_docs__ = {'requestModelRepaint': 'Emitted by the item to request a repaint of the parent model scene.\n', 'aboutToChange': 'Emitted when the definition of the associated component is about to be\nchanged by the item.\n\nThe ``text`` argument gives the translated text describing the change\nabout to occur, and the optional ``id`` can be used to group the\nassociated undo commands.\n', 'changed': 'Emitted when the definition of the associated component is changed by\nthe item.\n', 'repaintArrows': 'Emitted when item requests that all connected arrows are repainted.\n', 'updateArrowPaths': 'Emitted when item requires that all connected arrow paths are\nrecalculated.\n', 'sizePositionChanged': "Emitted when the item's size or position changes.\n"}
QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap']
QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkedParameterDataType', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap']
QgsModelComponentGraphicItem.__abstract_methods__ = ['fillColor', 'strokeColor', 'textColor', 'updateStoredComponentPosition']
QgsModelComponentGraphicItem.__overridden_methods__ = ['mouseDoubleClickEvent', 'hoverEnterEvent', 'hoverMoveEvent', 'hoverLeaveEvent', 'itemChange', 'boundingRect', 'contains', 'paint']
QgsModelComponentGraphicItem.__signal_arguments__ = {'aboutToChange': ['text: str', 'id: int = 0']}
@ -15,7 +15,7 @@ try:
except (NameError, AttributeError):
pass
try:
QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent']
QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'linkedParameterDataType', 'linkColor', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent']
QgsModelParameterGraphicItem.__group__ = ['processing', 'models']
except (NameError, AttributeError):
pass

View File

@ -0,0 +1,18 @@
# The following has been generated automatically from src/gui/qgsshortcutsmanager.h
# monkey patching scoped based enum
QgsShortcutsManager.CommonAction.CodeToggleComment.__doc__ = "Toggle code comments"
QgsShortcutsManager.CommonAction.CodeReformat.__doc__ = "Reformat code"
QgsShortcutsManager.CommonAction.CodeRunScript.__doc__ = "Run script"
QgsShortcutsManager.CommonAction.CodeRunSelection.__doc__ = "Run selection from script"
QgsShortcutsManager.CommonAction.__doc__ = """Contains common actions which are used across a variety of classes.
.. versionadded:: 4.0
* ``CodeToggleComment``: Toggle code comments
* ``CodeReformat``: Reformat code
* ``CodeRunScript``: Run script
* ``CodeRunSelection``: Run selection from script
"""
# --
QgsShortcutsManager.CommonAction.baseClass = QgsShortcutsManager

View File

@ -112,6 +112,8 @@ Shows a preview of moving the item from its stored position by ``dx``,
Sets a new scene ``rect`` for the item.
%End
virtual QString linkedParameterDataType( Qt::Edge edge, int index ) const;
virtual void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event );
virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event );
@ -324,6 +326,13 @@ comment
Updates the item's button positions, based on the current item rect.
%End
QColor fallbackColor() const;
%Docstring
Returns the fallback color if the parameter or output does not have a
specific color.
.. versionadded:: 4.0
%End
};
QFlags<QgsModelComponentGraphicItem::Flag> operator|(QgsModelComponentGraphicItem::Flag f1, QFlags<QgsModelComponentGraphicItem::Flag> f2);
@ -362,6 +371,12 @@ Ownership of ``parameter`` is transferred to the item.
virtual bool canDeleteComponent();
virtual QString linkedParameterDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ) const;
virtual QColor linkColor( Qt::Edge edge, int index ) const;
protected:
virtual QColor fillColor( State state ) const;

View File

@ -182,6 +182,23 @@ 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
corresponds to.
.. versionadded:: 4.0
%End
bool isDefaultParameterValue() const;
%Docstring
Returns ``True`` if the parameter is set to the default parameter value.
.. versionadded:: 4.0
%End
signals:
};

View File

@ -23,6 +23,14 @@ rather accessed through :py:func:`QgsGui.shortcutsManager()`.
#include "qgsshortcutsmanager.h"
%End
public:
enum class CommonAction
{
CodeToggleComment,
CodeReformat,
CodeRunScript,
CodeRunSelection,
};
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
%Docstring
Constructor for QgsShortcutsManager.
@ -36,6 +44,8 @@ Constructor for QgsShortcutsManager.
QGIS actions.
%End
~QgsShortcutsManager();
void registerAllChildren( QObject *object, bool recursive = false, const QString &section = QString() );
%Docstring
Automatically registers all QActions and QShortcuts which are children
@ -105,6 +115,16 @@ in GUI.
.. seealso:: :py:func:`unregisterAction`
.. seealso:: :py:func:`registerAllChildActions`
%End
void initializeCommonAction( QAction *action, CommonAction commonAction );
%Docstring
Initializes an ``action`` as a common action.
This automatically configures the ``action`` to use the properties for
the common action, such as setting the action's tooltip and shortcut.
.. versionadded:: 4.0
%End
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString &section = QString() );
@ -290,6 +310,14 @@ if no shortcut is associated.
.. seealso:: :py:func:`objectForSequence`
.. seealso:: :py:func:`actionForSequence`
%End
QKeySequence sequenceForCommonAction( CommonAction action ) const;
%Docstring
Returns the key sequence which is associated with a common ``action``,
or an empty sequence if no shortcut is assigned to that action.
.. versionadded:: 4.0
%End
QAction *actionByName( const QString &name ) const;

View File

@ -6977,28 +6977,30 @@ QgsShapeburstFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwid
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L236
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L221
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L163
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L171
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L155
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L213
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L262
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L254
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L94
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L70
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L81
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L59
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L106
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L180
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L196
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L204
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L188
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L246
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L243
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L229
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L116
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L126
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L267
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L246
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L188
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L196
QgsShortcutsManager.initializeCommonAction: src/gui/qgsshortcutsmanager.h#L119
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L180
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L238
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L293
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L285
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L109
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L85
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L96
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L74
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L131
QgsShortcutsManager.sequenceForCommonAction: src/gui/qgsshortcutsmanager.h#L260
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L205
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L221
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L229
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L213
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L277
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L274
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L254
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L141
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L151
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271

View File

@ -30,7 +30,7 @@ from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QPalette
from qgis.PyQt.QtWidgets import QMessageBox, QFileDialog, QVBoxLayout
from qgis.gui import QgsGui, QgsErrorDialog, QgsCodeEditorWidget
from qgis.gui import QgsGui, QgsErrorDialog, QgsCodeEditorWidget, QgsShortcutsManager
from qgis.core import (
QgsApplication,
QgsFileUtils,
@ -122,6 +122,9 @@ class ScriptEditorDialog(BASE, WIDGET):
self.palette().color(QPalette.ColorRole.WindowText),
)
)
QgsGui.shortcutsManager().initializeCommonAction(
self.actionToggleComment, QgsShortcutsManager.CommonAction.CodeToggleComment
)
# Connect signals and slots
self.actionOpenScript.triggered.connect(self.openScript)

View File

@ -8,6 +8,8 @@ set(QGIS_3D_SRCS
qgsaabb.cpp
qgsabstract3dengine.cpp
qgsabstractvectorlayer3drenderer.cpp
qgsannotationlayer3drenderer.cpp
qgsannotationlayerchunkloader_p.cpp
qgs3danimationsettings.cpp
qgs3dexportobject.cpp
qgs3dmapexportsettings.cpp
@ -154,6 +156,8 @@ set(QGIS_3D_HDRS
qgsaabb.h
qgsabstract3dengine.h
qgsabstractvectorlayer3drenderer.h
qgsannotationlayer3drenderer.h
qgsannotationlayerchunkloader_p.h
qgscameracontroller.h
qgscamerapose.h
qgsgeotransform.h

View File

@ -27,6 +27,7 @@
#include "qgsmeshlayer3drenderer.h"
#include "qgspointcloudlayer3drenderer.h"
#include "qgstiledscenelayer3drenderer.h"
#include "qgsannotationlayer3drenderer.h"
#include "qgs3dsymbolregistry.h"
#include "qgspoint3dsymbol.h"
#include "qgsline3dsymbol.h"
@ -68,6 +69,7 @@ void Qgs3D::initialize()
QgsApplication::renderer3DRegistry()->addRenderer( new QgsMeshLayer3DRendererMetadata );
QgsApplication::renderer3DRegistry()->addRenderer( new QgsPointCloudLayer3DRendererMetadata );
QgsApplication::renderer3DRegistry()->addRenderer( new QgsTiledSceneLayer3DRendererMetadata );
QgsApplication::renderer3DRegistry()->addRenderer( new QgsAnnotationLayer3DRendererMetadata );
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "point" ), QObject::tr( "Point" ), &QgsPoint3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForPoint3DSymbol ) );
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "line" ), QObject::tr( "Line" ), &QgsLine3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForLine3DSymbol ) );

View File

@ -45,6 +45,7 @@
#include "qgsapplication.h"
#include "qgsaabb.h"
#include "qgsabstract3dengine.h"
#include "qgsannotationlayer.h"
#include "qgs3dmapsettings.h"
#include "qgs3dutils.h"
#include "qgsabstract3drenderer.h"
@ -66,6 +67,7 @@
#include "qgsterraingenerator.h"
#include "qgstiledscenelayer.h"
#include "qgstiledscenelayer3drenderer.h"
#include "qgsannotationlayer3drenderer.h"
#include "qgsdirectionallightsettings.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayer3drenderer.h"
@ -746,6 +748,11 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
QgsTiledSceneLayer3DRenderer *tiledSceneRenderer = static_cast<QgsTiledSceneLayer3DRenderer *>( renderer );
tiledSceneRenderer->setLayer( static_cast<QgsTiledSceneLayer *>( layer ) );
}
else if ( layer->type() == Qgis::LayerType::Annotation && renderer->type() == QLatin1String( "annotation" ) )
{
auto annotationLayerRenderer = qgis::down_cast<QgsAnnotationLayer3DRenderer *>( renderer );
annotationLayerRenderer->setLayer( qobject_cast<QgsAnnotationLayer *>( layer ) );
}
Qt3DCore::QEntity *newEntity = renderer->createEntity( &mMap );
if ( newEntity )

View File

@ -1161,7 +1161,7 @@ QgsCameraPose Qgs3DUtils::lineSegmentToCameraPose( const QgsVector3D &startPoint
std::unique_ptr<Qt3DRender::QCamera> Qgs3DUtils::copyCamera( Qt3DRender::QCamera *cam )
{
std::unique_ptr<Qt3DRender::QCamera> copy = std::make_unique<Qt3DRender::QCamera>();
auto copy = std::make_unique<Qt3DRender::QCamera>();
copy->setPosition( cam->position() );
copy->setViewCenter( cam->viewCenter() );
copy->setUpVector( cam->upVector() );

View File

@ -0,0 +1,155 @@
/***************************************************************************
qgsannotationlayer3drenderer.cpp
--------------------------------------
Date : January 2020
Copyright : (C) 2020 by Martin Dobias
Email : wonder dot sk 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 "qgsannotationlayer3drenderer.h"
#include "qgsannotationlayer.h"
#include "qgsannotationlayerchunkloader_p.h"
#include "qgis.h"
//
// QgsAnnotationLayer3DRendererMetadata
//
QgsAnnotationLayer3DRendererMetadata::QgsAnnotationLayer3DRendererMetadata()
: Qgs3DRendererAbstractMetadata( QStringLiteral( "annotation" ) )
{
}
QgsAbstract3DRenderer *QgsAnnotationLayer3DRendererMetadata::createRenderer( QDomElement &elem, const QgsReadWriteContext &context )
{
auto r = std::make_unique< QgsAnnotationLayer3DRenderer >();
r->readXml( elem, context );
return r.release();
}
//
// QgsAnnotationLayer3DRenderer
//
QgsAnnotationLayer3DRenderer::QgsAnnotationLayer3DRenderer() = default;
void QgsAnnotationLayer3DRenderer::setLayer( QgsAnnotationLayer *layer )
{
mLayerRef = QgsMapLayerRef( layer );
}
QgsAnnotationLayer *QgsAnnotationLayer3DRenderer::layer() const
{
return qobject_cast<QgsAnnotationLayer *>( mLayerRef.layer );
}
void QgsAnnotationLayer3DRenderer::resolveReferences( const QgsProject &project )
{
mLayerRef.resolve( &project );
}
bool QgsAnnotationLayer3DRenderer::showCalloutLines() const
{
return mShowCalloutLines;
}
void QgsAnnotationLayer3DRenderer::setShowCalloutLines( bool show )
{
mShowCalloutLines = show;
}
void QgsAnnotationLayer3DRenderer::setCalloutLineColor( const QColor &color )
{
mCalloutLineColor = color;
}
QColor QgsAnnotationLayer3DRenderer::calloutLineColor() const
{
return mCalloutLineColor;
}
void QgsAnnotationLayer3DRenderer::setCalloutLineWidth( double width )
{
mCalloutLineWidth = width;
}
double QgsAnnotationLayer3DRenderer::calloutLineWidth() const
{
return mCalloutLineWidth;
}
QString QgsAnnotationLayer3DRenderer::type() const
{
return "annotation";
}
QgsAnnotationLayer3DRenderer *QgsAnnotationLayer3DRenderer::clone() const
{
auto r = std::make_unique< QgsAnnotationLayer3DRenderer >();
r->mLayerRef = mLayerRef;
r->mAltClamping = mAltClamping;
r->mZOffset = mZOffset;
r->mShowCalloutLines = mShowCalloutLines;
r->mCalloutLineColor = mCalloutLineColor;
r->mCalloutLineWidth = mCalloutLineWidth;
return r.release();
}
Qt3DCore::QEntity *QgsAnnotationLayer3DRenderer::createEntity( Qgs3DMapSettings *map ) const
{
QgsAnnotationLayer *l = layer();
if ( !l )
return nullptr;
// For some cases we start with a maximal z range because we can't know this upfront, as it potentially involves terrain heights.
// This range will be refined after populating the nodes to the actual z range of the generated chunks nodes.
// Assuming the vertical height is in meter, then it's extremely unlikely that a real vertical
// height will exceed this amount!
constexpr double MINIMUM_ANNOTATION_Z_ESTIMATE = -100000;
constexpr double MAXIMUM_ANNOTATION_Z_ESTIMATE = 100000;
double minimumZ = MINIMUM_ANNOTATION_Z_ESTIMATE;
double maximumZ = MAXIMUM_ANNOTATION_Z_ESTIMATE;
switch ( mAltClamping )
{
case Qgis::AltitudeClamping::Absolute:
// special case where we DO know the exact z range upfront!
minimumZ = mZOffset;
maximumZ = mZOffset;
break;
case Qgis::AltitudeClamping::Relative:
case Qgis::AltitudeClamping::Terrain:
break;
}
return new QgsAnnotationLayerChunkedEntity( map, l, mAltClamping, mZOffset, mShowCalloutLines, mCalloutLineColor, mCalloutLineWidth, minimumZ, maximumZ );
}
void QgsAnnotationLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWriteContext & ) const
{
QDomDocument doc = elem.ownerDocument();
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
elem.setAttribute( QStringLiteral( "clamping" ), qgsEnumValueToKey( mAltClamping ) );
elem.setAttribute( QStringLiteral( "offset" ), mZOffset );
if ( mShowCalloutLines )
elem.setAttribute( QStringLiteral( "callouts" ), QStringLiteral( "1" ) );
}
void QgsAnnotationLayer3DRenderer::readXml( const QDomElement &elem, const QgsReadWriteContext & )
{
mLayerRef = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) );
mAltClamping = qgsEnumKeyToValue( elem.attribute( QStringLiteral( "clamping" ) ), Qgis::AltitudeClamping::Relative );
mZOffset = elem.attribute( QStringLiteral( "offset" ), QString::number( DEFAULT_Z_OFFSET ) ).toDouble();
mShowCalloutLines = elem.attribute( QStringLiteral( "callouts" ), QStringLiteral( "0" ) ).toInt();
}

View File

@ -0,0 +1,185 @@
/***************************************************************************
qgsannotationlayer3drenderer.h
--------------------------------------
Date : September 2025
Copyright : (C) 2025 by 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 QGSANNOTATIONLAYER3DRENDERER_H
#define QGSANNOTATIONLAYER3DRENDERER_H
#include "qgis_3d.h"
#include "qgis_sip.h"
#include "qgs3drendererregistry.h"
#include "qgsabstract3drenderer.h"
#include "qgsmaplayerref.h"
class QgsAnnotationLayer;
#ifdef SIP_RUN
// this is needed for the "convert to subclass" code below to compile
% ModuleHeaderCode
#include "qgsannotationlayer3drenderer.h"
% End
#endif
/**
* \ingroup core
* \brief Metadata for annotation layer 3D renderer to allow creation of its instances from XML.
*
* \warning This is not considered stable API, and may change in future QGIS releases. It is
* exposed to the Python bindings as a tech preview only.
*
* \since QGIS 4.0
*/
class _3D_EXPORT QgsAnnotationLayer3DRendererMetadata : public Qgs3DRendererAbstractMetadata
{
public:
QgsAnnotationLayer3DRendererMetadata();
//! Creates an instance of a 3D renderer based on a DOM element with renderer configuration
QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) override SIP_FACTORY;
};
/**
* \ingroup qgis_3d
* \brief 3D renderers for annotation layers.
*
* \since QGIS 4.0
*/
class _3D_EXPORT QgsAnnotationLayer3DRenderer : public QgsAbstract3DRenderer
{
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
sipType = sipType_QgsAnnotationLayer3DRenderer;
else
sipType = nullptr;
SIP_END
#endif
public:
QgsAnnotationLayer3DRenderer();
/**
* Sets the annotation layer associated with the renderer.
*
* \see layer()
*/
void setLayer( QgsAnnotationLayer *layer );
/**
* Returns the annotation layer associated with the renderer.
*
* \see setLayer()
*/
QgsAnnotationLayer *layer() const;
QString type() const override;
QgsAnnotationLayer3DRenderer *clone() const override SIP_FACTORY;
Qt3DCore::QEntity *createEntity( Qgs3DMapSettings *map ) const override SIP_SKIP;
void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
void resolveReferences( const QgsProject &project ) override;
/**
* Returns the altitude clamping method, which determines the vertical position of annotations.
*
* \see setAltitudeClamping()
*/
Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
/**
* Sets the altitude \a clamping method, which determines the vertical position of annotations.
*
* \see altitudeClamping()
*/
void setAltitudeClamping( Qgis::AltitudeClamping clamping ) { mAltClamping = clamping; }
/**
* Returns the z offset, which is a fixed offset amount which should be added to z values for the annotations.
*
* \see setZOffset()
*/
double zOffset() const { return mZOffset; }
/**
* Sets the z \a offset, which is a fixed offset amount which will be added to z values for the annotations.
*
* \see zOffset()
*/
void setZOffset( double offset ) { mZOffset = offset; }
/**
* Returns TRUE if callout lines are shown, vertically joining the annotations to the terrain.
*
* \see setShowCalloutLines()
*/
bool showCalloutLines() const;
/**
* Sets whether callout lines are shown, vertically joining the annotations to the terrain.
*
* \see showCalloutLines()
*/
void setShowCalloutLines( bool show );
// TODO -- consider exposing via QgsSimpleLineMaterialSettings, for now, for testing only
/**
* Sets the callout line \a color.
*
* \see calloutLineColor()
* \note Not available in Python bindings
*/
SIP_SKIP void setCalloutLineColor( const QColor &color );
/**
* Returns the callout line color.
*
* \see setCalloutLineColor()
* \note Not available in Python bindings
*/
SIP_SKIP QColor calloutLineColor() const;
/**
* Sets the callout line \a width.
*
* \see calloutLineWidth()
* \note Not available in Python bindings
*/
SIP_SKIP void setCalloutLineWidth( double width );
/**
* Returns the callout line width.
*
* \see setCalloutLineWidth()
* \note Not available in Python bindings
*/
SIP_SKIP double calloutLineWidth() const;
private:
#ifdef SIP_RUN
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
#endif
static constexpr double DEFAULT_Z_OFFSET = 50;
QgsMapLayerRef mLayerRef;
Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative;
double mZOffset = DEFAULT_Z_OFFSET;
bool mShowCalloutLines = true;
QColor mCalloutLineColor { 0, 0, 0 };
double mCalloutLineWidth = 2;
};
#endif // QGSANNOTATIONLAYER3DRENDERER_H

View File

@ -0,0 +1,396 @@
/***************************************************************************
qgsannotationlayerchunkloader_p.cpp
--------------------------------------
Date : September 2025
Copyright : (C) 2025 by 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 "qgsannotationlayerchunkloader_p.h"
#include "moc_qgsannotationlayerchunkloader_p.cpp"
#include "qgs3dutils.h"
#include "qgsannotationitem.h"
#include "qgstessellatedpolygongeometry.h"
#include "qgschunknode.h"
#include "qgseventtracing.h"
#include "qgslogger.h"
#include "qgsannotationlayer.h"
#include "qgsabstract3dsymbol.h"
#include "qgsabstractterrainsettings.h"
#include "qgsannotationmarkeritem.h"
#include "qgsbillboardgeometry.h"
#include "qgspoint3dbillboardmaterial.h"
#include "qgsgeotransform.h"
#include "qgsexpressioncontextutils.h"
#include "qgstextureatlasgenerator.h"
#include "qgslinevertexdata_p.h"
#include "qgslinematerial_p.h"
#include <QtConcurrent>
#include <Qt3DCore/QTransform>
///@cond PRIVATE
QgsAnnotationLayerChunkLoader::QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node )
: QgsChunkLoader( node )
, mFactory( factory )
, mRenderContext( factory->mRenderContext )
{
}
struct Billboard
{
QVector3D position;
int textureId;
};
void QgsAnnotationLayerChunkLoader::start()
{
QgsChunkNode *node = chunk();
if ( node->level() < mFactory->mLeafLevel )
{
QTimer::singleShot( 0, this, &QgsAnnotationLayerChunkLoader::finished );
return;
}
QgsAnnotationLayer *layer = mFactory->mLayer;
mLayerName = mFactory->mLayer->name();
// only a subset of data to be queried
const QgsRectangle rect = node->box3D().toRectangle();
// origin for coordinates of the chunk - it is kind of arbitrary, but it should be
// picked so that the coordinates are relatively small to avoid numerical precision issues
mChunkOrigin = QgsVector3D( rect.center().x(), rect.center().y(), 0 );
QgsExpressionContext exprContext;
exprContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) );
mRenderContext.setExpressionContext( exprContext );
QgsCoordinateTransform layerToMapTransform( layer->crs(), mRenderContext.crs(), mRenderContext.transformContext() );
QgsRectangle layerExtent;
try
{
layerExtent = layerToMapTransform.transformBoundingBox( rect, Qgis::TransformDirection::Reverse );
}
catch ( QgsCsException &e )
{
QgsDebugError( QStringLiteral( "Error transforming annotation layer extent to 3d map extent: %1" ).arg( e.what() ) );
return;
}
const double zOffset = mFactory->mZOffset;
const Qgis::AltitudeClamping altitudeClamping = mFactory->mClamping;
bool showCallouts = mFactory->mShowCallouts;
// see logic from QgsAnnotationLayerRenderer
const QStringList itemsList = layer->queryIndex( layerExtent );
QSet< QString > itemIds( itemsList.begin(), itemsList.end() );
// we also have NO choice but to clone ALL non-indexed items (i.e. those with a scale-dependent bounding box)
// since these won't be in the layer's spatial index, and it's too expensive to determine their actual bounding box
// upfront (we are blocking the main thread right now!)
// TODO -- come up with some brilliant way to avoid this and also index scale-dependent items ;)
itemIds.unite( layer->mNonIndexedItems );
mItemsToRender.reserve( itemIds.size() );
std::transform( itemIds.begin(), itemIds.end(), std::back_inserter( mItemsToRender ), [layer]( const QString &id ) -> std::unique_ptr< QgsAnnotationItem > {
return std::unique_ptr< QgsAnnotationItem >( layer->item( id )->clone() );
} );
//
// this will be run in a background thread
//
mFutureWatcher = new QFutureWatcher<void>( this );
connect( mFutureWatcher, &QFutureWatcher<void>::finished, this, &QgsChunkQueueJob::finished );
const QFuture<void> future = QtConcurrent::run( [this, rect, layerToMapTransform, zOffset, altitudeClamping, showCallouts] {
const QgsEventTracing::ScopedEvent e( QStringLiteral( "3D" ), QStringLiteral( "Annotation layer chunk load" ) );
std::vector< Billboard > billboards;
billboards.reserve( mItemsToRender.size() );
QVector< QImage > textures;
textures.reserve( mItemsToRender.size() );
for ( const std::unique_ptr< QgsAnnotationItem > &item : std::as_const( mItemsToRender ) )
{
if ( mCanceled )
break;
QgsAnnotationItem *annotation = item.get();
if ( !annotation->enabled() )
continue;
if ( QgsAnnotationMarkerItem *marker = dynamic_cast< QgsAnnotationMarkerItem * >( annotation ) )
{
if ( marker->symbol() )
{
QgsPointXY p = marker->geometry();
try
{
const QgsPointXY mapPoint = layerToMapTransform.transform( p );
if ( !rect.contains( mapPoint ) )
continue;
double z = 0;
const float terrainZ = ( altitudeClamping == Qgis::AltitudeClamping::Absolute && !showCallouts ) ? 0 : mRenderContext.terrainRenderingEnabled() && mRenderContext.terrainGenerator() ? static_cast<float>( mRenderContext.terrainGenerator()->heightAt( mapPoint.x(), mapPoint.y(), mRenderContext ) * mRenderContext.terrainSettings()->verticalScale() )
: 0.f;
switch ( altitudeClamping )
{
case Qgis::AltitudeClamping::Absolute:
z = zOffset;
break;
case Qgis::AltitudeClamping::Terrain:
z = terrainZ;
break;
case Qgis::AltitudeClamping::Relative:
z = terrainZ + zOffset;
break;
}
Billboard billboard;
billboard.position = ( QgsVector3D( mapPoint.x(), mapPoint.y(), z ) - mChunkOrigin ).toVector3D();
billboard.textureId = textures.size();
textures.append( QgsPoint3DBillboardMaterial::renderSymbolToImage( marker->symbol(), mRenderContext ) );
billboards.emplace_back( std::move( billboard ) );
if ( showCallouts )
{
mCalloutLines << QgsLineString( { mapPoint.x(), mapPoint.x() }, { mapPoint.y(), mapPoint.y() }, { terrainZ, z } );
}
mZMax = std::max( mZMax, showCallouts ? std::max( 0.0, z ) : z );
mZMin = std::min( mZMin, showCallouts ? std::min( 0.0, z ) : z );
}
catch ( QgsCsException &e )
{
QgsDebugError( e.what() );
}
}
}
}
// free memory
mItemsToRender.clear();
const QgsTextureAtlas atlas = QgsTextureAtlasGenerator::createFromImages( textures, 2048 );
if ( atlas.isValid() )
{
mBillboardAtlas = atlas.renderAtlasTexture();
mBillboardPositions.reserve( static_cast< int >( billboards.size() ) );
for ( Billboard &billboard : billboards )
{
const QRect textureRect = atlas.rect( billboard.textureId );
QgsBillboardGeometry::BillboardAtlasData geometry;
geometry.position = billboard.position;
geometry.textureAtlasOffset = QVector2D( static_cast< float >( textureRect.left() ) / static_cast< float>( mBillboardAtlas.width() ), 1 - ( static_cast< float >( textureRect.bottom() ) / static_cast< float>( mBillboardAtlas.height() ) ) );
geometry.textureAtlasSize = QVector2D( static_cast< float >( textureRect.width() ) / static_cast< float>( mBillboardAtlas.width() ), static_cast< float>( textureRect.height() ) / static_cast< float>( mBillboardAtlas.height() ) );
mBillboardPositions.append( geometry );
}
}
else
{
QgsDebugError( QStringLiteral( "Error encountered building texture atlas" ) );
mBillboardAtlas = QImage();
}
} );
// emit finished() as soon as the handler is populated with features
mFutureWatcher->setFuture( future );
}
QgsAnnotationLayerChunkLoader::~QgsAnnotationLayerChunkLoader()
{
if ( mFutureWatcher && !mFutureWatcher->isFinished() )
{
disconnect( mFutureWatcher, &QFutureWatcher<void>::finished, this, &QgsChunkQueueJob::finished );
mFutureWatcher->waitForFinished();
}
}
void QgsAnnotationLayerChunkLoader::cancel()
{
mCanceled = true;
}
Qt3DCore::QEntity *QgsAnnotationLayerChunkLoader::createEntity( Qt3DCore::QEntity *parent )
{
if ( mNode->level() < mFactory->mLeafLevel )
{
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity( parent ); // dummy entity
entity->setObjectName( mLayerName + "_CONTAINER_" + mNode->tileId().text() );
return entity;
}
if ( mBillboardPositions.empty() )
{
// an empty node, so we return no entity. This tags the node as having no data and effectively removes it.
// we just make sure first that its initial estimated vertical range does not affect its parents' bboxes calculation
mNode->setExactBox3D( QgsBox3D() );
mNode->updateParentBoundingBoxesRecursively();
return nullptr;
}
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity( parent );
entity->setObjectName( mLayerName + "_" + mNode->tileId().text() );
QgsBillboardGeometry *billboardGeometry = new QgsBillboardGeometry();
billboardGeometry->setBillboardData( mBillboardPositions );
Qt3DRender::QGeometryRenderer *billboardGeometryRenderer = new Qt3DRender::QGeometryRenderer;
billboardGeometryRenderer->setPrimitiveType( Qt3DRender::QGeometryRenderer::Points );
billboardGeometryRenderer->setGeometry( billboardGeometry );
billboardGeometryRenderer->setVertexCount( billboardGeometry->count() );
QgsPoint3DBillboardMaterial *billboardMaterial = new QgsPoint3DBillboardMaterial( QgsPoint3DBillboardMaterial::Mode::AtlasTexture );
billboardMaterial->setTexture2DFromImage( mBillboardAtlas );
QgsGeoTransform *billboardTransform = new QgsGeoTransform;
billboardTransform->setGeoTranslation( mChunkOrigin );
Qt3DCore::QEntity *billboardEntity = new Qt3DCore::QEntity;
billboardEntity->addComponent( billboardMaterial );
billboardEntity->addComponent( billboardTransform );
billboardEntity->addComponent( billboardGeometryRenderer );
billboardEntity->setParent( entity );
if ( mFactory->mShowCallouts )
{
QgsLineVertexData lineData;
lineData.withAdjacency = true;
lineData.geocentricCoordinates = false; // mMapSettings->sceneMode() == Qgis::SceneMode::Globe;
lineData.init( Qgis::AltitudeClamping::Absolute, Qgis::AltitudeBinding::Vertex, 0, mRenderContext, mChunkOrigin );
for ( const QgsLineString &line : mCalloutLines )
{
lineData.addLineString( line, 0, false );
}
QgsLineMaterial *mat = new QgsLineMaterial;
mat->setLineColor( mFactory->mCalloutLineColor );
mat->setLineWidth( mFactory->mCalloutLineWidth );
Qt3DCore::QEntity *calloutEntity = new Qt3DCore::QEntity;
calloutEntity->setObjectName( parent->objectName() + "_CALLOUTS" );
// geometry renderer
Qt3DRender::QGeometryRenderer *calloutRenderer = new Qt3DRender::QGeometryRenderer;
calloutRenderer->setPrimitiveType( Qt3DRender::QGeometryRenderer::LineStripAdjacency );
calloutRenderer->setGeometry( lineData.createGeometry( calloutEntity ) );
calloutRenderer->setVertexCount( lineData.indexes.count() );
calloutRenderer->setPrimitiveRestartEnabled( true );
calloutRenderer->setRestartIndexValue( 0 );
// make entity
calloutEntity->addComponent( calloutRenderer );
calloutEntity->addComponent( mat );
calloutEntity->setParent( billboardEntity );
}
// fix the vertical range of the node from the estimated vertical range to the true range
if ( mZMin != std::numeric_limits<float>::max() && mZMax != std::numeric_limits<float>::lowest() )
{
QgsBox3D box = mNode->box3D();
box.setZMinimum( mZMin );
box.setZMaximum( mZMax );
mNode->setExactBox3D( box );
mNode->updateParentBoundingBoxesRecursively();
}
return entity;
}
///////////////
QgsAnnotationLayerChunkLoaderFactory::QgsAnnotationLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsAnnotationLayer *layer, int leafLevel, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax )
: mRenderContext( context )
, mLayer( layer )
, mLeafLevel( leafLevel )
, mClamping( clamping )
, mZOffset( zOffset )
, mShowCallouts( showCallouts )
, mCalloutLineColor( calloutLineColor )
, mCalloutLineWidth( calloutLineWidth )
{
if ( context.crs().type() == Qgis::CrsType::Geocentric )
{
// TODO: add support for handling of annotation layers
// (we're using dummy quadtree here to make sure the empty extent does not break the scene completely)
QgsDebugError( QStringLiteral( "Annotation layers in globe scenes are not supported yet!" ) );
setupQuadtree( QgsBox3D( -1e7, -1e7, -1e7, 1e7, 1e7, 1e7 ), -1, leafLevel );
return;
}
QgsBox3D rootBox3D( context.extent(), zMin, zMax );
// add small padding to avoid clipping of point features located at the edge of the bounding box
rootBox3D.grow( 1.0 );
setupQuadtree( rootBox3D, -1, leafLevel ); // negative root error means that the node does not contain anything
}
QgsChunkLoader *QgsAnnotationLayerChunkLoaderFactory::createChunkLoader( QgsChunkNode *node ) const
{
return new QgsAnnotationLayerChunkLoader( this, node );
}
///////////////
QgsAnnotationLayerChunkedEntity::QgsAnnotationLayerChunkedEntity( Qgs3DMapSettings *map, QgsAnnotationLayer *layer, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax )
: QgsChunkedEntity( map,
-1, // max. allowed screen error (negative tau means that we need to go until leaves are reached)
new QgsAnnotationLayerChunkLoaderFactory( Qgs3DRenderContext::fromMapSettings( map ), layer, 3, clamping, zOffset, showCallouts, calloutLineColor, calloutLineWidth, zMin, zMax ), true )
{
mTransform = new Qt3DCore::QTransform;
if ( applyTerrainOffset() )
{
mTransform->setTranslation( QVector3D( 0.0f, 0.0f, static_cast<float>( map->terrainSettings()->elevationOffset() ) ) );
}
this->addComponent( mTransform );
connect( map, &Qgs3DMapSettings::terrainSettingsChanged, this, &QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged );
}
QgsAnnotationLayerChunkedEntity::~QgsAnnotationLayerChunkedEntity()
{
// cancel / wait for jobs
cancelActiveJobs();
}
// if the AltitudeClamping is `Absolute`, do not apply the offset
bool QgsAnnotationLayerChunkedEntity::applyTerrainOffset() const
{
if ( auto loaderFactory = static_cast<QgsAnnotationLayerChunkLoaderFactory *>( mChunkLoaderFactory ) )
{
return loaderFactory->mClamping != Qgis::AltitudeClamping::Absolute;
}
return true;
}
void QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged()
{
QgsDebugMsgLevel( QStringLiteral( "QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged" ), 2 );
float newOffset = static_cast<float>( qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset() );
if ( !applyTerrainOffset() )
{
newOffset = 0.0;
}
mTransform->setTranslation( QVector3D( 0.0f, 0.0f, newOffset ) );
}
/// @endcond

View File

@ -0,0 +1,146 @@
/***************************************************************************
qgsannotationlayerchunkloader_p.h
--------------------------------------
Date : September 2025
Copyright : (C) 2025 by 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 QGSANNOTATIONLAYERCHUNKLOADER_P_H
#define QGSANNOTATIONLAYERCHUNKLOADER_P_H
///@cond PRIVATE
//
// W A R N I N G
// -------------
//
// This file is not part of the QGIS API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
#include "qgschunkloader.h"
#include "qgschunkedentity.h"
#include "qgs3drendercontext.h"
#include "qgsbillboardgeometry.h"
#include <QImage>
#define SIP_NO_FILE
class QgsAnnotationLayer;
class QgsAnnotationItem;
namespace Qt3DCore
{
class QTransform;
}
#include <QFutureWatcher>
/**
* \ingroup qgis_3d
* \brief This loader factory is responsible for creation of loaders of QgsAnnotationLayerChunkedEntity.
*
* \since QGIS 4.0
*/
class QgsAnnotationLayerChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
{
Q_OBJECT
public:
//! Constructs the factory
QgsAnnotationLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsAnnotationLayer *layer, int leafLevel, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax );
//! Creates loader for the given chunk node. Ownership of the returned is passed to the caller.
virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
Qgs3DRenderContext mRenderContext;
QgsAnnotationLayer *mLayer = nullptr;
int mLeafLevel = 0;
Qgis::AltitudeClamping mClamping = Qgis::AltitudeClamping::Relative;
double mZOffset = 0;
bool mShowCallouts = false;
QColor mCalloutLineColor;
double mCalloutLineWidth = 2;
};
/**
* \ingroup qgis_3d
* \brief This loader class is responsible for async loading of data for QgsAnnotationLayerChunkedEntity
* and creation of final 3D entity from the data previously prepared in a worker thread.
*
* \since QGIS 4.0
*/
class QgsAnnotationLayerChunkLoader : public QgsChunkLoader
{
Q_OBJECT
public:
//! Constructs the loader
QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node );
~QgsAnnotationLayerChunkLoader() override;
void start() override;
virtual void cancel() override;
virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
private:
const QgsAnnotationLayerChunkLoaderFactory *mFactory = nullptr;
Qgs3DRenderContext mRenderContext;
bool mCanceled = false;
QFutureWatcher<void> *mFutureWatcher = nullptr;
QString mLayerName;
QgsVector3D mChunkOrigin;
std::vector< std::unique_ptr< QgsAnnotationItem > > mItemsToRender;
QVector< QgsBillboardGeometry::BillboardAtlasData > mBillboardPositions;
QVector< QgsLineString > mCalloutLines;
QImage mBillboardAtlas;
double mZMin = std::numeric_limits< double >::max();
double mZMax = std::numeric_limits< double >::lowest();
};
/**
* \ingroup qgis_3d
* \brief 3D entity used for rendering of annotation layers.
*
* Internally it uses QgsAnnotationLayerChunkLoaderFactory and
* QgsAnnotationLayerChunkLoader to do the actual work
* of loading and creating 3D sub-entities for the layer.
*
* \since QGIS 4.0
*/
class QgsAnnotationLayerChunkedEntity : public QgsChunkedEntity
{
Q_OBJECT
public:
//! Constructs the entity.
explicit QgsAnnotationLayerChunkedEntity( Qgs3DMapSettings *map, QgsAnnotationLayer *layer, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax );
~QgsAnnotationLayerChunkedEntity();
private slots:
void onTerrainElevationOffsetChanged();
private:
Qt3DCore::QTransform *mTransform = nullptr;
bool applyTerrainOffset() const;
friend class TestQgsChunkedEntity;
};
/// @endcond
#endif // QGSANNOTATIONLAYERCHUNKLOADER_P_H

View File

@ -296,7 +296,7 @@ QgsPointCloudLayer *QgsPdalAlgorithmBase::parameterAsPointCloudLayer( const QVar
return nullptr;
// if COPC provider, return as it is
if ( layer->dataProvider()->name() == QStringLiteral( "copc" ) )
if ( layer->dataProvider()->name() == QLatin1String( "copc" ) )
{
return layer;
}

View File

@ -94,7 +94,7 @@ void QgsGeometryCheckAngleAlgorithm::initAlgorithm( const QVariantMap &configura
QStringLiteral( "ERRORS" ), QObject::tr( "Small angle errors" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -97,7 +97,7 @@ void QgsGeometryCheckAreaAlgorithm::initAlgorithm( const QVariantMap &configurat
QStringLiteral( "OUTPUT" ), QObject::tr( "Small polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -98,7 +98,7 @@ void QgsGeometryCheckContainedAlgorithm::initAlgorithm( const QVariantMap &confi
QStringLiteral( "OUTPUT" ), QObject::tr( "Contained features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);

View File

@ -88,7 +88,7 @@ void QgsGeometryCheckDangleAlgorithm::initAlgorithm( const QVariantMap &configur
QStringLiteral( "OUTPUT" ), QObject::tr( "Dangle-end features" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -87,7 +87,7 @@ void QgsGeometryCheckDegeneratePolygonAlgorithm::initAlgorithm( const QVariantMa
QStringLiteral( "OUTPUT" ), QObject::tr( "Degenerate polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
auto tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
tolerance->setHelp( QObject::tr( "The \"Tolerance\" advanced parameter defines the numerical precision of geometric operations, "
"given as an integer n, meaning that any difference smaller than 10⁻ⁿ (in map units) is considered zero." ) );

View File

@ -94,7 +94,7 @@ void QgsGeometryCheckDuplicateAlgorithm::initAlgorithm( const QVariantMap &confi
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicate geometries" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -89,7 +89,7 @@ void QgsGeometryCheckDuplicateNodesAlgorithm::initAlgorithm( const QVariantMap &
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicated vertices features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -92,7 +92,7 @@ void QgsGeometryCheckFollowBoundariesAlgorithm::initAlgorithm( const QVariantMap
QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ), QList<int>() << static_cast<int>( Qgis::ProcessingSourceType::VectorPolygon )
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -108,7 +108,7 @@ void QgsGeometryCheckGapAlgorithm::initAlgorithm( const QVariantMap &configurati
QStringLiteral( "OUTPUT" ), QObject::tr( "Gap features" ), Qgis::ProcessingSourceType::VectorPolygon
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -94,7 +94,7 @@ void QgsGeometryCheckHoleAlgorithm::initAlgorithm( const QVariantMap &configurat
QStringLiteral( "OUTPUT" ), QObject::tr( "Polygons with holes" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -88,7 +88,7 @@ void QgsGeometryCheckLineIntersectionAlgorithm::initAlgorithm( const QVariantMap
QStringLiteral( "OUTPUT" ), QObject::tr( "Intersecting feature" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -94,7 +94,7 @@ void QgsGeometryCheckLineLayerIntersectionAlgorithm::initAlgorithm( const QVaria
QStringLiteral( "OUTPUT" ), QObject::tr( "Line intersecting other layer features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -95,7 +95,7 @@ void QgsGeometryCheckMissingVertexAlgorithm::initAlgorithm( const QVariantMap &c
QStringLiteral( "OUTPUT" ), QObject::tr( "Missing vertices features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -93,7 +93,7 @@ void QgsGeometryCheckMultipartAlgorithm::initAlgorithm( const QVariantMap &confi
QStringLiteral( "OUTPUT" ), QObject::tr( "One-part geometry features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -92,7 +92,7 @@ void QgsGeometryCheckOverlapAlgorithm::initAlgorithm( const QVariantMap &configu
QStringLiteral( "MIN_OVERLAP_AREA" ), QObject::tr( "Minimum overlap area" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -88,7 +88,7 @@ void QgsGeometryCheckPointCoveredByLineAlgorithm::initAlgorithm( const QVariantM
QStringLiteral( "ERRORS" ), QObject::tr( "Points not covered by a line" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -88,7 +88,7 @@ void QgsGeometryCheckPointInPolygonAlgorithm::initAlgorithm( const QVariantMap &
QStringLiteral( "ERRORS" ), QObject::tr( "Points outside polygons errors" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -93,7 +93,7 @@ void QgsGeometryCheckSegmentLengthAlgorithm::initAlgorithm( const QVariantMap &c
QStringLiteral( "MIN_SEGMENT_LENGTH" ), QObject::tr( "Minimum segment length" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -89,7 +89,7 @@ void QgsGeometryCheckSelfContactAlgorithm::initAlgorithm( const QVariantMap &con
QStringLiteral( "OUTPUT" ), QObject::tr( "Self contact features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -91,7 +91,7 @@ void QgsGeometryCheckSelfIntersectionAlgorithm::initAlgorithm( const QVariantMap
QStringLiteral( "OUTPUT" ), QObject::tr( "Self-intersecting features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -100,7 +100,7 @@ void QgsGeometryCheckSliverPolygonAlgorithm::initAlgorithm( const QVariantMap &c
QStringLiteral( "MAX_AREA" ), QObject::tr( "Maximum area (map units squared)" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -196,11 +196,11 @@ QVariantMap QgsClimbAlgorithm::processAlgorithm( const QVariantMap &parameters,
if ( !noGeometry.empty() )
{
feedback->pushInfo( QObject::tr( "The following features do not have geometry: %1" ).arg( noGeometry.join( QStringLiteral( ", " ) ) ) );
feedback->pushInfo( QObject::tr( "The following features do not have geometry: %1" ).arg( noGeometry.join( QLatin1String( ", " ) ) ) );
}
if ( !noZValue.empty() )
{
feedback->pushInfo( QObject::tr( "The following points do not have Z value: %1" ).arg( noZValue.join( QStringLiteral( ", " ) ) ) );
feedback->pushInfo( QObject::tr( "The following points do not have Z value: %1" ).arg( noZValue.join( QLatin1String( ", " ) ) ) );
}
QVariantMap results;

View File

@ -107,7 +107,7 @@ void QgsFixGeometryAngleAlgorithm::initAlgorithm( const QVariantMap &configurati
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing small angles" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -120,7 +120,7 @@ void QgsFixGeometryAreaAlgorithm::initAlgorithm( const QVariantMap &configuratio
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from merging small polygons" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -104,7 +104,7 @@ void QgsFixGeometryDuplicateNodesAlgorithm::initAlgorithm( const QVariantMap &co
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing duplicate vertices" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -108,7 +108,7 @@ void QgsFixGeometryGapAlgorithm::initAlgorithm( const QVariantMap &configuration
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing gaps" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -104,7 +104,7 @@ void QgsFixGeometryHoleAlgorithm::initAlgorithm( const QVariantMap &configuratio
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing holes" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -105,7 +105,7 @@ void QgsFixGeometryMissingVertexAlgorithm::initAlgorithm( const QVariantMap &con
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing border vertices" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -91,7 +91,7 @@ void QgsFixGeometryMultipartAlgorithm::initAlgorithm( const QVariantMap &configu
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing multiparts" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -99,7 +99,7 @@ void QgsFixGeometryOverlapAlgorithm::initAlgorithm( const QVariantMap &configura
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing overlaps" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -129,7 +129,7 @@ void QgsFixGeometrySelfIntersectionAlgorithm::initAlgorithm( const QVariantMap &
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing self-intersections" ), Qgis::ProcessingSourceType::VectorPoint
) );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
);
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );

View File

@ -90,7 +90,7 @@ Qgis::ProcessingFeatureSourceFlags QgsRemovePartsByAreaAlgorithm::sourceFlags()
void QgsRemovePartsByAreaAlgorithm::initParameters( const QVariantMap & )
{
std::unique_ptr< QgsProcessingParameterArea > minArea = std::make_unique< QgsProcessingParameterArea >( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
auto minArea = std::make_unique< QgsProcessingParameterArea >( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
minArea->setIsDynamic( true );
minArea->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), QgsPropertyDefinition::DoublePositive ) );
minArea->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );

View File

@ -90,7 +90,7 @@ Qgis::ProcessingFeatureSourceFlags QgsRemovePartsByLengthAlgorithm::sourceFlags(
void QgsRemovePartsByLengthAlgorithm::initParameters( const QVariantMap & )
{
std::unique_ptr< QgsProcessingParameterDistance > minLength = std::make_unique< QgsProcessingParameterDistance >( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with lengths less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
auto minLength = std::make_unique< QgsProcessingParameterDistance >( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with lengths less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
minLength->setIsDynamic( true );
minLength->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with length less than" ), QgsPropertyDefinition::DoublePositive ) );
minLength->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );

View File

@ -0,0 +1,199 @@
/***************************************************************************
qgsannotationlayer3drendererwidget.cpp
------------------------------
Date : September 2025
Copyright : (C) 2025 by 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 "qgsannotationlayer3drendererwidget.h"
#include "moc_qgsannotationlayer3drendererwidget.cpp"
#include "qgsapplication.h"
#include "qgsannotationlayer.h"
#include "qgsannotationlayer3drenderer.h"
#include <QBoxLayout>
#include <QCheckBox>
QgsAnnotationLayer3DRendererWidget::QgsAnnotationLayer3DRendererWidget( QgsAnnotationLayer *layer, QgsMapCanvas *canvas, QWidget *parent )
: QgsMapLayerConfigWidget( layer, canvas, parent )
{
setPanelTitle( tr( "3D View" ) );
setObjectName( QStringLiteral( "mOptsPage_3DView" ) );
setupUi( this );
mComboRendererType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "rendererNullSymbol.svg" ) ), tr( "No Symbols" ), QVariant::fromValue( RendererType::None ) );
mComboRendererType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "rendererSingleSymbol.svg" ) ), tr( "3D Billboards" ), QVariant::fromValue( RendererType::Billboards ) );
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::None ) ) );
mStackedWidget->setCurrentWidget( mPageNoRenderer );
connect( mComboRendererType, qOverload< int >( &QComboBox::currentIndexChanged ), this, &QgsAnnotationLayer3DRendererWidget::rendererTypeChanged );
mComboClamping->addItem( tr( "Relative to Terrain" ), QVariant::fromValue( Qgis::AltitudeClamping::Relative ) );
mComboClamping->addItem( tr( "Absolute" ), QVariant::fromValue( Qgis::AltitudeClamping::Absolute ) );
connect( mComboClamping, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsAnnotationLayer3DRendererWidget::clampingChanged );
mComboClamping->setCurrentIndex( mComboClamping->findData( QVariant::fromValue( Qgis::AltitudeClamping::Relative ) ) );
clampingChanged();
connect( mOffsetZSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ), this, [this]( double ) {
if ( !mBlockChanges )
emit widgetChanged();
} );
connect( mCheckShowCallouts, &QCheckBox::toggled, this, [this] {
if ( !mBlockChanges )
emit widgetChanged();
} );
syncToLayer( layer );
}
void QgsAnnotationLayer3DRendererWidget::setRenderer( const QgsAnnotationLayer3DRenderer *renderer )
{
mBlockChanges++;
mRenderer.reset( renderer ? renderer->clone() : nullptr );
if ( renderer )
{
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::Billboards ) ) );
mComboClamping->setCurrentIndex( mComboClamping->findData( QVariant::fromValue( renderer->altitudeClamping() ) ) );
mOffsetZSpinBox->setValue( renderer->zOffset() );
mCheckShowCallouts->setChecked( renderer->showCalloutLines() );
}
else
{
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::None ) ) );
}
mBlockChanges--;
}
std::unique_ptr< QgsAnnotationLayer3DRenderer > QgsAnnotationLayer3DRendererWidget::renderer()
{
const RendererType type = mComboRendererType->currentData().value< RendererType >();
switch ( type )
{
case RendererType::None:
return nullptr;
break;
case RendererType::Billboards:
{
auto renderer = std::make_unique< QgsAnnotationLayer3DRenderer >();
renderer->setAltitudeClamping( mComboClamping->currentData().value< Qgis::AltitudeClamping >() );
renderer->setZOffset( mOffsetZSpinBox->value() );
renderer->setShowCalloutLines( mCheckShowCallouts->isChecked() );
return renderer;
}
}
BUILTIN_UNREACHABLE
}
void QgsAnnotationLayer3DRendererWidget::apply()
{
std::unique_ptr< QgsAnnotationLayer3DRenderer > r = renderer();
mLayer->setRenderer3D( r.release() );
}
void QgsAnnotationLayer3DRendererWidget::rendererTypeChanged()
{
const RendererType type = mComboRendererType->currentData().value< RendererType >();
switch ( type )
{
case RendererType::None:
mStackedWidget->setCurrentWidget( mPageNoRenderer );
break;
case RendererType::Billboards:
mStackedWidget->setCurrentWidget( mPageBillboards );
break;
}
if ( !mBlockChanges )
emit widgetChanged();
}
void QgsAnnotationLayer3DRendererWidget::clampingChanged()
{
switch ( mComboClamping->currentData().value< Qgis::AltitudeClamping >() )
{
case Qgis::AltitudeClamping::Absolute:
mLabelClampingExplanation->setText(
QStringLiteral( "<p><b>%1</b></p><p>%2</p>" ).arg( tr( "All billboards will be placed at the same elevation." ), tr( "The terrain height will be ignored." ) )
);
break;
case Qgis::AltitudeClamping::Relative:
mLabelClampingExplanation->setText(
QStringLiteral( "<p><b>%1</b></p>" ).arg( tr( "Billboard elevation is relative to terrain height." ) )
);
break;
case Qgis::AltitudeClamping::Terrain:
mLabelClampingExplanation->setText(
QStringLiteral( "<p><b>%1</b></p><p>%2</p>" ).arg( tr( "Billboard elevation will be taken directly from the terrain height." ), tr( "Billboards will be placed directly on the terrain." ) )
);
break;
}
if ( !mBlockChanges )
emit widgetChanged();
}
void QgsAnnotationLayer3DRendererWidget::syncToLayer( QgsMapLayer *layer )
{
mLayer = layer;
QgsAbstract3DRenderer *r = layer->renderer3D();
if ( r && r->type() == QLatin1String( "annotation" ) )
{
QgsAnnotationLayer3DRenderer *annotationRenderer = qgis::down_cast<QgsAnnotationLayer3DRenderer *>( r );
setRenderer( annotationRenderer );
}
else
{
setRenderer( nullptr );
}
}
//
// QgsAnnotationLayer3DRendererWidgetFactory
//
QgsAnnotationLayer3DRendererWidgetFactory::QgsAnnotationLayer3DRendererWidgetFactory( QObject *parent )
: QObject( parent )
{
setIcon( QIcon( ":/images/themes/default/3d.svg" ) );
setTitle( tr( "3D View" ) );
}
QgsMapLayerConfigWidget *QgsAnnotationLayer3DRendererWidgetFactory::createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const
{
Q_UNUSED( dockWidget )
QgsAnnotationLayer *annotationLayer = qobject_cast<QgsAnnotationLayer *>( layer );
if ( !annotationLayer )
return nullptr;
return new QgsAnnotationLayer3DRendererWidget( annotationLayer, canvas, parent );
}
bool QgsAnnotationLayer3DRendererWidgetFactory::supportLayerPropertiesDialog() const
{
return true;
}
bool QgsAnnotationLayer3DRendererWidgetFactory::supportsStyleDock() const
{
return true;
}
bool QgsAnnotationLayer3DRendererWidgetFactory::supportsLayer( QgsMapLayer *layer ) const
{
return layer->type() == Qgis::LayerType::Annotation;
}
QString QgsAnnotationLayer3DRendererWidgetFactory::layerPropertiesPagePositionHint() const
{
return QStringLiteral( "mOptsPage_Rendering" );
}

View File

@ -0,0 +1,75 @@
/***************************************************************************
qgsannotationlayer3drendererwidget.h
------------------------------
Date : September 2025
Copyright : (C) 2025 by 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 QGSANNOTATIONLAYER3DRENDERERWIDGET_H
#define QGSANNOTATIONLAYER3DRENDERERWIDGET_H
#include <memory>
#include "qgsmaplayerconfigwidget.h"
#include "qgsmaplayerconfigwidgetfactory.h"
#include "ui_qgsannotationlayer3drendererwidget.h"
class QgsAnnotationLayer;
class QgsAnnotationLayer3DRenderer;
class QgsMapCanvas;
//! Widget for configuration of 3D renderer of an annotation layer
class QgsAnnotationLayer3DRendererWidget : public QgsMapLayerConfigWidget, private Ui::QgsAnnotationLayer3dRendererWidgetBase
{
Q_OBJECT
public:
enum class RendererType
{
None,
Billboards,
};
Q_ENUM( RendererType )
explicit QgsAnnotationLayer3DRendererWidget( QgsAnnotationLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
void syncToLayer( QgsMapLayer *layer ) final;
//! no transfer of ownership
void setRenderer( const QgsAnnotationLayer3DRenderer *renderer );
std::unique_ptr< QgsAnnotationLayer3DRenderer > renderer();
public slots:
void apply() override;
private slots:
void rendererTypeChanged();
void clampingChanged();
private:
int mBlockChanges = 0;
std::unique_ptr<QgsAnnotationLayer3DRenderer> mRenderer;
};
class QgsAnnotationLayer3DRendererWidgetFactory : public QObject, public QgsMapLayerConfigWidgetFactory
{
Q_OBJECT
public:
explicit QgsAnnotationLayer3DRendererWidgetFactory( QObject *parent = nullptr );
QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const override;
bool supportLayerPropertiesDialog() const override;
bool supportsStyleDock() const override;
bool supportsLayer( QgsMapLayer *layer ) const override;
QString layerPropertiesPagePositionHint() const override;
};
#endif // QGSANNOTATIONLAYER3DRENDERERWIDGET_H

View File

@ -353,6 +353,7 @@ if (WITH_3D)
3d/qgs3dmodelsourcelineedit.cpp
3d/qgs3dnavigationwidget.cpp
3d/qgs3doptions.cpp
3d/qgsannotationlayer3drendererwidget.cpp
3d/qgsgoochmaterialwidget.cpp
3d/qgslightswidget.cpp
3d/qgsline3dsymbolwidget.cpp

View File

@ -327,11 +327,14 @@ void QgsAppLayerHandling::postProcessAddedLayers( const QList<QgsMapLayer *> &la
}
break;
}
case Qgis::LayerType::Annotation:
postProcessAddedLayer( layer );
break;
case Qgis::LayerType::Raster:
case Qgis::LayerType::Plugin:
case Qgis::LayerType::Mesh:
case Qgis::LayerType::VectorTile:
case Qgis::LayerType::Annotation:
case Qgis::LayerType::PointCloud:
case Qgis::LayerType::Group:
case Qgis::LayerType::TiledScene:

View File

@ -156,6 +156,7 @@
#include "qgsmeshlayer3drendererwidget.h"
#include "qgspointcloudlayer3drendererwidget.h"
#include "qgstiledscenelayer3drendererwidget.h"
#include "qgsannotationlayer3drendererwidget.h"
#include "qgs3dapputils.h"
#include "qgs3doptions.h"
#include "qgsmapviewsmanager.h"
@ -1329,12 +1330,6 @@ QgisApp::QgisApp( QSplashScreen *splash, AppOptions options, const QString &root
registerMapLayerPropertiesFactory( new QgsVectorLayerDigitizingPropertiesFactory( this ) );
registerMapLayerPropertiesFactory( new QgsPointCloudRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsTiledSceneRendererWidgetFactory( this ) );
#ifdef HAVE_3D
registerMapLayerPropertiesFactory( new QgsVectorLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsMeshLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsPointCloudLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsTiledSceneLayer3DRendererWidgetFactory( this ) );
#endif
registerMapLayerPropertiesFactory( new QgsPointCloudElevationPropertiesWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsRasterElevationPropertiesWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsVectorElevationPropertiesWidgetFactory( this ) );
@ -1342,6 +1337,13 @@ QgisApp::QgisApp( QSplashScreen *splash, AppOptions options, const QString &root
registerMapLayerPropertiesFactory( new QgsMeshElevationPropertiesWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsAnnotationItemPropertiesWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsLayerTreeGroupPropertiesWidgetFactory( this ) );
#ifdef HAVE_3D
registerMapLayerPropertiesFactory( new QgsVectorLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsMeshLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsPointCloudLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsTiledSceneLayer3DRendererWidgetFactory( this ) );
registerMapLayerPropertiesFactory( new QgsAnnotationLayer3DRendererWidgetFactory( this ) );
#endif
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mInfoBar, mMapLayerPanelFactories );
mMapStylingDock->setWidget( mMapStyleWidget );
@ -3247,7 +3249,7 @@ void QgisApp::showStyleManager()
void QgisApp::initPythonConsoleOptions()
{
QgsPythonRunner::run( QStringLiteral( "import console" ) );
QgsPythonRunner::run( QStringLiteral( "console.init_options_widget()" ) );
QgsPythonRunner::run( QStringLiteral( "console.init_console()" ) );
}
void QgisApp::showPythonDialog()
@ -7953,6 +7955,7 @@ void QgisApp::createAnnotationLayer()
// layer should be created at top of layer tree
QgsProject::instance()->addMapLayer( layer, false );
QgsProject::instance()->layerTreeRoot()->insertLayer( 0, layer );
QgsAppLayerHandling::postProcessAddedLayers( { layer } );
}
void QgisApp::setCadDockVisible( bool visible )

View File

@ -157,7 +157,7 @@ void QgsAuthPlanetaryComputerEdit::updateServerType( int indx )
lblTenantId->setVisible( isPro );
leTenantId->setVisible( isPro );
const QString openHelp = tr( "Use this server type for %1 - the data are publicly accessible and do not require an account." ).arg( QStringLiteral( "<a href=\"https://planetarycomputer.microsoft.com/\">https://planetarycomputer.microsoft.com/</a>" ) );
const QString openHelp = tr( "Use this server type for %1 - the data are publicly accessible and do not require an account." ).arg( QLatin1String( "<a href=\"https://planetarycomputer.microsoft.com/\">https://planetarycomputer.microsoft.com/</a>" ) );
const QString proHelp = tr(
"Use this server type for <a href=\"https://learn.microsoft.com/en-us/azure/planetary-computer/get-started-planetary-computer\">Planetary Computer Pro</a> instances.<br/>"
"The Directory (tenant) and Application (client) IDs can be found in your organization's Microsoft Entra ID main and application page respectively.<br/>"

View File

@ -241,6 +241,7 @@ class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer
QgsMapLayerRef mLinkedLayer;
friend class QgsAnnotationLayerRenderer;
friend class QgsAnnotationLayerChunkLoader;
};

View File

@ -4627,7 +4627,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
// insert \a result geometry (obtain by the chamfer/fillet operation) back into original \a inputPoly polygon
auto updatePolygon = []( const QgsPolygon * inputPoly, QgsAbstractGeometry * result, int modifiedRing ) -> std::unique_ptr<QgsPolygon>
{
std::unique_ptr<QgsPolygon> newPoly = std::make_unique<QgsPolygon>();
auto newPoly = std::make_unique<QgsPolygon>();
for ( int ringIndex = 0; ringIndex < inputPoly->numInteriorRings() + 1; ++ringIndex )
{
if ( ringIndex == modifiedRing )
@ -4656,7 +4656,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
{
if ( modifiedPart >= 0 )
{
std::unique_ptr<QgsMultiLineString> newMultiLine = std::make_unique<QgsMultiLineString>();
auto newMultiLine = std::make_unique<QgsMultiLineString>();
int partIndex = 0;
for ( QgsMultiLineString::part_iterator partIte = inputMultiLine->parts_begin(); partIte != inputMultiLine->parts_end(); ++partIte )
{
@ -4686,7 +4686,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
// geomType == Qgis::GeometryType::Polygon
if ( modifiedPart >= 0 )
{
std::unique_ptr<QgsMultiPolygon> newMultiPoly = std::make_unique<QgsMultiPolygon>();
auto newMultiPoly = std::make_unique<QgsMultiPolygon>();
int partIndex = 0;
for ( QgsAbstractGeometry::part_iterator partIte = inputMultiPoly->parts_begin(); partIte != inputMultiPoly->parts_end(); ++partIte )
{

View File

@ -972,7 +972,7 @@ bool QgsLayoutItemElevationProfile::readPropertiesFromElement( const QDomElement
QDomElement sourceElement = sourcesElement.firstChildElement();
while ( !sourceElement.isNull() )
{
if ( sourceElement.tagName() == QStringLiteral( "profileCustomSource" ) )
if ( sourceElement.tagName() == QLatin1String( "profileCustomSource" ) )
{
const QString sourceId = sourceElement.attribute( QStringLiteral( "id" ) );
if ( QgsAbstractProfileSource *profileSource = QgsApplication::profileSourceRegistry()->findSourceById( sourceId ) )
@ -980,7 +980,7 @@ bool QgsLayoutItemElevationProfile::readPropertiesFromElement( const QDomElement
mSources.append( profileSource );
}
}
else if ( sourceElement.tagName() == QStringLiteral( "profileLayerSource" ) )
else if ( sourceElement.tagName() == QLatin1String( "profileLayerSource" ) )
{
QgsMapLayerRef ref;
ref.readXml( sourceElement, context );

View File

@ -403,7 +403,7 @@ inline std::unique_ptr<Chain> Problem::chain( int seed )
{
// A lot of conflict : make them inactive and store chain
std::unique_ptr< Chain > newChain = std::make_unique< Chain >();
auto newChain = std::make_unique< Chain >();
newChain->degree = currentChain.size() + 1 + conflicts.size();
newChain->feat.resize( newChain->degree );
newChain->label.resize( newChain->degree );

View File

@ -44,7 +44,7 @@ bool QgsVectorLayerXyPlotDataGatherer::run()
gatheredSeries.reserve( mSeriesDetails.size() );
for ( int i = 0; i < mSeriesDetails.size(); i++ )
{
std::unique_ptr<QgsXyPlotSeries> series = std::make_unique<QgsXyPlotSeries>();
auto series = std::make_unique<QgsXyPlotSeries>();
gatheredSeries.emplace_back( std::move( series ) );
gatheredSeriesCategoriesSum << QMap<QString, double>();
}

View File

@ -224,8 +224,21 @@ QString QgsProcessingModelChildParameterSource::friendlyIdentifier( QgsProcessin
switch ( mSource )
{
case Qgis::ProcessingModelChildParameterSource::ModelParameter:
return model ? model->parameterDefinition( mParameterName )->description() : mParameterName;
{
if ( model )
{
const QgsProcessingParameterDefinition *paramDefinition = model->parameterDefinition( mParameterName );
// A model can be valid (non null) but we could be looking for a null parameter (if input if not set yet)
if ( paramDefinition )
{
return model->parameterDefinition( mParameterName )->description();
}
}
return mParameterName;
}
case Qgis::ProcessingModelChildParameterSource::ChildOutput:
{
if ( model )
@ -242,11 +255,11 @@ QString QgsProcessingModelChildParameterSource::friendlyIdentifier( QgsProcessin
break;
}
}
return QObject::tr( "'%1' from algorithm '%2'" ).arg( outputName, alg.description() );
return QObject::tr( "<%1>" ).arg( alg.description() );
}
else
{
return QObject::tr( "'%1' from algorithm '%2'" ).arg( mOutputName, mChildId );
return QObject::tr( "<%1>" ).arg( mChildId );
}
}

View File

@ -48,6 +48,11 @@ QString QgsProcessingOutputDefinition::valueAsFormattedString( const QVariant &v
return valueAsString( value, context, ok );
}
QColor QgsProcessingOutputDefinition::modelColor() const
{
return QColor( 128, 128, 128 ); /* mid gray */
}
QgsProcessingOutputVectorLayer::QgsProcessingOutputVectorLayer( const QString &name, const QString &description, Qgis::ProcessingSourceType type )
: QgsProcessingOutputDefinition( name, description )
, mDataType( type )
@ -63,10 +68,20 @@ void QgsProcessingOutputVectorLayer::setDataType( Qgis::ProcessingSourceType typ
mDataType = type;
}
QColor QgsProcessingOutputVectorLayer::modelColor() const
{
return QColor( 122, 0, 47 ); /* burgundy */
}
QgsProcessingOutputRasterLayer::QgsProcessingOutputRasterLayer( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
QColor QgsProcessingOutputRasterLayer::modelColor() const
{
return QColor( 0, 180, 180 ); /* turquoise */
}
QgsProcessingOutputPointCloudLayer::QgsProcessingOutputPointCloudLayer( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -75,6 +90,11 @@ QgsProcessingOutputVectorTileLayer::QgsProcessingOutputVectorTileLayer( const QS
: QgsProcessingOutputDefinition( name, description )
{}
QColor QgsProcessingOutputVectorTileLayer::modelColor() const
{
return QColor( 137, 150, 171 ); /* cold gray */
}
QgsProcessingOutputHtml::QgsProcessingOutputHtml( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -90,6 +110,11 @@ QString QgsProcessingOutputHtml::valueAsFormattedString( const QVariant &value,
return valueAsString( value, context, ok );
}
QColor QgsProcessingOutputHtml::modelColor() const
{
return QColor( 255, 131, 23 ); /* orange */
}
QgsProcessingOutputNumber::QgsProcessingOutputNumber( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -112,10 +137,20 @@ QString QgsProcessingOutputNumber::valueAsString( const QVariant &value, QgsProc
return QgsProcessingOutputDefinition::valueAsString( value, context, ok );
}
QColor QgsProcessingOutputNumber::modelColor() const
{
return QColor( 34, 157, 214 ); /* blue */
}
QgsProcessingOutputString::QgsProcessingOutputString( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
QColor QgsProcessingOutputString::modelColor() const
{
return QColor( 255, 131, 23 ); /* orange */
}
QgsProcessingOutputBoolean::QgsProcessingOutputBoolean( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -131,6 +166,11 @@ QString QgsProcessingOutputBoolean::valueAsString( const QVariant &value, QgsPro
return QgsProcessingOutputDefinition::valueAsString( value, context, ok );
}
QColor QgsProcessingOutputBoolean::modelColor() const
{
return QColor( 51, 201, 28 ); /* green */
}
QgsProcessingOutputFolder::QgsProcessingOutputFolder( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -146,6 +186,11 @@ QString QgsProcessingOutputFolder::valueAsFormattedString( const QVariant &value
return valueAsString( value, context, ok );
}
QColor QgsProcessingOutputFolder::modelColor() const
{
return QColor( 80, 80, 80 ); /* dark gray */
}
QgsProcessingOutputFile::QgsProcessingOutputFile( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -161,6 +206,11 @@ QString QgsProcessingOutputFile::valueAsFormattedString( const QVariant &value,
return valueAsString( value, context, ok );
}
QColor QgsProcessingOutputFile::modelColor() const
{
return QColor( 80, 80, 80 ); /* dark gray */
}
QgsProcessingOutputMapLayer::QgsProcessingOutputMapLayer( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -170,6 +220,11 @@ QString QgsProcessingOutputMapLayer::type() const
return typeName();
}
QColor QgsProcessingOutputMapLayer::modelColor() const
{
return QColor( 137, 150, 171 ); /* cold gray */
}
QgsProcessingOutputMultipleLayers::QgsProcessingOutputMultipleLayers( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -210,6 +265,11 @@ QString QgsProcessingOutputMultipleLayers::valueAsString( const QVariant &value,
return QgsProcessingOutputDefinition::valueAsString( value, context, ok );
}
QColor QgsProcessingOutputMultipleLayers::modelColor() const
{
return QColor( 137, 150, 171 ); /* cold gray */
}
QgsProcessingOutputConditionalBranch::QgsProcessingOutputConditionalBranch( const QString &name, const QString &description )
: QgsProcessingOutputDefinition( name, description )
{}
@ -266,3 +326,4 @@ QString QgsProcessingOutputVariant::valueAsString( const QVariant &value, QgsPro
}
return QgsProcessingOutputDefinition::valueAsString( value, context, ok );
}

View File

@ -18,6 +18,7 @@
#ifndef QGSPROCESSINGOUTPUTS_H
#define QGSPROCESSINGOUTPUTS_H
#include <QColor>
#include "qgis_core.h"
#include "qgis.h"
@ -85,6 +86,13 @@ class CORE_EXPORT QgsProcessingOutputDefinition
virtual ~QgsProcessingOutputDefinition() = default;
/**
* Returns the color to use for the output in model designer windows.
*
* \since QGIS 4.0
*/
virtual QColor modelColor() const;
/**
* Unique output type name.
*/
@ -195,6 +203,8 @@ class CORE_EXPORT QgsProcessingOutputMapLayer : public QgsProcessingOutputDefini
*/
QgsProcessingOutputMapLayer( const QString &name, const QString &description = QString() );
QColor modelColor() const override;
/**
* Returns the type name for the output class.
*/
@ -218,6 +228,8 @@ class CORE_EXPORT QgsProcessingOutputVectorLayer : public QgsProcessingOutputDef
*/
QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), Qgis::ProcessingSourceType type = Qgis::ProcessingSourceType::VectorAnyGeometry );
QColor modelColor() const override;
/**
* Returns the type name for the output class.
*/
@ -259,6 +271,8 @@ class CORE_EXPORT QgsProcessingOutputRasterLayer : public QgsProcessingOutputDef
* Returns the type name for the output class.
*/
static QString typeName() { return QStringLiteral( "outputRaster" ); }
QColor modelColor() const override;
QString type() const override { return typeName(); }
};
@ -310,8 +324,9 @@ class CORE_EXPORT QgsProcessingOutputMultipleLayers : public QgsProcessingOutput
*/
static QString typeName() { return QStringLiteral( "outputMultilayer" ); }
QString type() const override;
QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
QColor modelColor() const override;
QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
};
/**
@ -333,6 +348,8 @@ class CORE_EXPORT QgsProcessingOutputHtml : public QgsProcessingOutputDefinition
*/
static QString typeName() { return QStringLiteral( "outputHtml" ); }
QString type() const override { return typeName(); }
QColor modelColor() const override;
QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
};
@ -356,6 +373,7 @@ class CORE_EXPORT QgsProcessingOutputVariant : public QgsProcessingOutputDefinit
* Returns the type name for the output class.
*/
static QString typeName() { return QStringLiteral( "outputVariant" ); }
QString type() const override;
QString valueAsString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
@ -375,6 +393,8 @@ class CORE_EXPORT QgsProcessingOutputNumber : public QgsProcessingOutputDefiniti
*/
QgsProcessingOutputNumber( const QString &name, const QString &description = QString() );
QColor modelColor() const override;
/**
* Returns the type name for the output class.
*/
@ -402,6 +422,8 @@ class CORE_EXPORT QgsProcessingOutputString : public QgsProcessingOutputDefiniti
* Returns the type name for the output class.
*/
static QString typeName() { return QStringLiteral( "outputString" ); }
QColor modelColor() const override;
QString type() const override { return typeName(); }
};
@ -420,6 +442,8 @@ class CORE_EXPORT QgsProcessingOutputBoolean : public QgsProcessingOutputDefinit
*/
QgsProcessingOutputBoolean( const QString &name, const QString &description = QString() );
QColor modelColor() const override ;
/**
* Returns the type name for the output class.
*/
@ -448,8 +472,9 @@ class CORE_EXPORT QgsProcessingOutputFolder : public QgsProcessingOutputDefiniti
*/
static QString typeName() { return QStringLiteral( "outputFolder" ); }
QString type() const override { return typeName(); }
QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
QColor modelColor() const override;
QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
};
/**
@ -471,8 +496,9 @@ class CORE_EXPORT QgsProcessingOutputFile : public QgsProcessingOutputDefinition
*/
static QString typeName() { return QStringLiteral( "outputFile" ); }
QString type() const override { return typeName(); }
QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
QColor modelColor() const override;
QString valueAsFormattedString( const QVariant &value, QgsProcessingContext &context, bool &ok SIP_OUT ) const override;
};
/**
@ -517,6 +543,8 @@ class CORE_EXPORT QgsProcessingOutputVectorTileLayer : public QgsProcessingOutpu
* Returns the type name for the output class.
*/
static QString typeName() { return QStringLiteral( "outputVectorTile" ); }
QColor modelColor() const override;
QString type() const override { return typeName(); }
};

View File

@ -39,6 +39,7 @@
#include "qgsproviderregistry.h"
#include "qgsvariantutils.h"
#include "qgsmessagelog.h"
#include "qgsunittypes.h"
#include <functional>
#include <QRegularExpression>
@ -66,7 +67,6 @@ bool QgsProcessingFeatureSourceDefinition::loadVariant( const QVariantMap &map )
return true;
}
//
// QgsProcessingRasterLayerDefinition
//
@ -3061,6 +3061,73 @@ QgsProcessingParameterDefinition *QgsProcessingParameterBoolean::clone() const
return new QgsProcessingParameterBoolean( *this );
}
QColor QgsProcessingParameterDefinition::modelColor() const
{
QgsProcessingParameterType *paramType = QgsApplication::processingRegistry()->parameterType( type() );
if ( paramType )
{
return paramType->modelColor();
}
return QgsProcessingParameterType::defaultModelColor();
}
QString QgsProcessingParameterDefinition::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
if ( value.userType() == qMetaTypeId<QgsPointXY>() )
{
const QgsPointXY r = value.value<QgsPointXY>();
return QStringLiteral( "%1, %2" ).arg( qgsDoubleToString( r.x(), 4 ),
qgsDoubleToString( r.y(), 4 ) );
}
else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
{
const QgsReferencedPointXY r = value.value<QgsReferencedPointXY>();
return QStringLiteral( "%1, %2 [%3]" ).arg(
qgsDoubleToString( r.x(), 4 ),
qgsDoubleToString( r.y(), 4 ),
r.crs().authid()
);
}
else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
{
const QgsGeometry g = QgsGeometry::fromRect( value.value<QgsRectangle>() );
return QgsWkbTypes::geometryDisplayString( g.type() );
}
else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
{
const QgsReferencedGeometry g = QgsReferencedGeometry::fromReferencedRect( value.value<QgsReferencedRectangle>() );
if ( !g.isNull() )
{
return QStringLiteral( "%1 [%2]" ).arg( QgsWkbTypes::geometryDisplayString( g.type() ), g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ) );
}
return QgsWkbTypes::geometryDisplayString( g.type() );
}
else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
{
const QgsProcessingOutputLayerDefinition fromVar = qvariant_cast<QgsProcessingOutputLayerDefinition>( value );
if ( fromVar.sink.propertyType() == Qgis::PropertyType::Static )
{
return fromVar.sink.staticValue().toString();
}
else
{
return fromVar.sink.asExpression();
}
}
return value.toString();
}
QString QgsProcessingParameterBoolean::valueAsPythonString( const QVariant &val, QgsProcessingContext & ) const
{
if ( !val.isValid() )
@ -3220,6 +3287,21 @@ QgsProcessingParameterCrs *QgsProcessingParameterCrs::fromScriptCode( const QStr
return new QgsProcessingParameterCrs( name, description, definition.compare( QLatin1String( "none" ), Qt::CaseInsensitive ) == 0 ? QVariant() : definition, isOptional );
}
QString QgsProcessingParameterCrs::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
QgsCoordinateReferenceSystem crs( value.toString() );
if ( crs.isValid() )
return crs.userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString );
return QObject::tr( "Invalid CRS" );
}
QgsProcessingParameterMapLayer::QgsProcessingParameterMapLayer( const QString &name, const QString &description, const QVariant &defaultValue, bool optional, const QList<int> &types )
: QgsProcessingParameterDefinition( name, description, defaultValue, optional )
, QgsProcessingParameterLimitedDataTypes( types )
@ -3652,7 +3734,8 @@ QString QgsProcessingParameterExtent::valueAsPythonString( const QVariant &value
return QStringLiteral( "'%1, %3, %2, %4 [%5]'" ).arg( qgsDoubleToString( r.xMinimum() ),
qgsDoubleToString( r.yMinimum() ),
qgsDoubleToString( r.xMaximum() ),
qgsDoubleToString( r.yMaximum() ), r.crs().authid() );
qgsDoubleToString( r.yMaximum() ),
r.crs().authid() );
}
else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
{
@ -3802,6 +3885,7 @@ QgsProcessingParameterPoint *QgsProcessingParameterPoint::fromScriptCode( const
return new QgsProcessingParameterPoint( name, description, definition, isOptional );
}
QgsProcessingParameterGeometry::QgsProcessingParameterGeometry( const QString &name, const QString &description,
const QVariant &defaultValue, bool optional, const QList<int> &geometryTypes, bool allowMultipart )
: QgsProcessingParameterDefinition( name, description, defaultValue, optional ),
@ -4073,6 +4157,45 @@ QgsProcessingParameterGeometry *QgsProcessingParameterGeometry::fromScriptCode(
return new QgsProcessingParameterGeometry( name, description, definition, isOptional );
}
QString QgsProcessingParameterGeometry::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
if ( value.isValid() )
{
if ( value.userType() == qMetaTypeId< QgsGeometry>() )
{
const QgsGeometry g = value.value<QgsGeometry>();
return QgsWkbTypes::geometryDisplayString( g.type() );
}
else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
{
const QgsReferencedGeometry g = value.value<QgsReferencedGeometry>();
if ( !g.isNull() )
{
return QStringLiteral( "%1 [%2]" ).arg( QgsWkbTypes::geometryDisplayString( g.type() ), g.crs().userFriendlyIdentifier( Qgis::CrsIdentifierType::ShortString ));
}
return QgsWkbTypes::geometryDisplayString( g.type() );
}
else if ( value.userType() == QMetaType::QString )
{
// In the case of a WKT-(string) encoded geometry, the type of geometry is going to be displayed
// rather than the possibly very long WKT payload
QgsGeometry g = QgsGeometry::fromWkt( value.toString() );
if ( !g.isNull() )
{
return QgsWkbTypes::geometryDisplayString( g.type() );
}
}
}
return QObject::tr( "Invalid geometry" );
}
QgsProcessingParameterFile::QgsProcessingParameterFile( const QString &name, const QString &description, Qgis::ProcessingFileParameterBehavior behavior, const QString &extension, const QVariant &defaultValue, bool optional, const QString &fileFilter )
: QgsProcessingParameterDefinition( name, description, defaultValue, optional )
, mBehavior( behavior )
@ -5391,6 +5514,14 @@ QString QgsProcessingParameterEnum::asPythonString( const QgsProcessing::PythonO
return QString();
}
QString QgsProcessingParameterEnum::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
return options().at( value.toInt() );
}
QStringList QgsProcessingParameterEnum::options() const
{
return mOptions;
@ -7855,6 +7986,14 @@ bool QgsProcessingParameterDistance::fromVariantMap( const QVariantMap &map )
}
QString QgsProcessingParameterDistance::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
return QStringLiteral( "%1 %2" ).arg( value.toString(), QgsUnitTypes::toAbbreviatedString( defaultUnit() ) );
}
//
// QgsProcessingParameterArea
@ -7937,6 +8076,14 @@ bool QgsProcessingParameterArea::fromVariantMap( const QVariantMap &map )
}
QString QgsProcessingParameterArea::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
return QStringLiteral( "%1 %2" ).arg( value.toString(), QgsUnitTypes::toAbbreviatedString( defaultUnit() ) );
}
//
// QgsProcessingParameterVolume
@ -8018,6 +8165,13 @@ bool QgsProcessingParameterVolume::fromVariantMap( const QVariantMap &map )
return true;
}
QString QgsProcessingParameterVolume::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
return QStringLiteral( "%1 %2" ).arg( value.toString(), QgsUnitTypes::toAbbreviatedString( defaultUnit() ) );
}
//
// QgsProcessingParameterDuration
@ -8075,6 +8229,14 @@ bool QgsProcessingParameterDuration::fromVariantMap( const QVariantMap &map )
return true;
}
QString QgsProcessingParameterDuration::userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
return QStringLiteral( "%1 %2" ).arg( value.toString(), QgsUnitTypes::toAbbreviatedString( defaultUnit() ) );
}
//
// QgsProcessingParameterScale
@ -8932,6 +9094,40 @@ QgsProcessingParameterDateTime *QgsProcessingParameterDateTime::fromScriptCode(
}
QString QgsProcessingParameterDateTime:: userFriendlyString( const QVariant &value ) const
{
if ( QgsVariantUtils::isNull( value ) )
return QString();
if ( value.userType() == QMetaType::Type::QDateTime )
{
const QDateTime dt = value.toDateTime();
if ( !dt.isValid() )
return QObject::tr( "Invalid datetime" );
else
return dt.toString( Qt::ISODate );
}
else if ( value.userType() == QMetaType::Type::QDate )
{
const QDate dt = value.toDate();
if ( !dt.isValid() )
return QObject::tr( "Invalid date" );
else
return dt.toString( Qt::ISODate );
}
else if ( value.userType() == QMetaType::Type::QTime )
{
const QTime dt = value.toTime();
if ( !dt.isValid() )
return QObject::tr( "Invalid time" );
else
return dt.toString( Qt::ISODate );
}
return value.toString();
}
//
// QgsProcessingParameterProviderConnection

View File

@ -28,6 +28,7 @@
#include "qgsremappingproxyfeaturesink.h"
#include <QMap>
#include <limits>
#include <QColor>
class QgsProcessingContext;
class QgsProcessingAlgorithm;
@ -554,6 +555,23 @@ class CORE_EXPORT QgsProcessingParameterDefinition
virtual ~QgsProcessingParameterDefinition() = default;
/**
* 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
*/
virtual QColor modelColor() const;
/**
* Returns a user-friendly string representation of the provided parameter \a value.
*
* The returned string is to be used for display purposes only, and should be translated as required.
* \since QGIS 4.0
*/
virtual QString userFriendlyString( const QVariant &value ) const;
/**
* Creates a clone of the parameter definition.
*/
@ -1906,6 +1924,8 @@ class CORE_EXPORT QgsProcessingParameterCrs : public QgsProcessingParameterDefin
QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
bool optional = false );
QString userFriendlyString( const QVariant &value ) const override;
/**
* Returns the type name for the parameter class.
*/
@ -2054,7 +2074,7 @@ class CORE_EXPORT QgsProcessingParameterGeometry : public QgsProcessingParameter
*/
void setAllowMultipart( bool allowMultipart ) { mAllowMultipart = allowMultipart; }
QString userFriendlyString( const QVariant &value ) const override;
/**
* Creates a new parameter using the definition from a script code.
@ -2185,6 +2205,7 @@ class CORE_EXPORT QgsProcessingParameterMatrix : public QgsProcessingParameterDe
* Returns the type name for the parameter class.
*/
static QString typeName() { return QStringLiteral( "matrix" ); }
QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
QString type() const override { return typeName(); }
bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
@ -2356,6 +2377,7 @@ class CORE_EXPORT QgsProcessingParameterNumber : public QgsProcessingParameterDe
* Returns the type name for the parameter class.
*/
static QString typeName() { return QStringLiteral( "number" ); }
QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
QString type() const override { return typeName(); }
bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
@ -2454,6 +2476,8 @@ class CORE_EXPORT QgsProcessingParameterDistance : public QgsProcessingParameter
*/
static QString typeName() { return QStringLiteral( "distance" ); } // cppcheck-suppress duplInheritedMember
QString userFriendlyString( const QVariant &value ) const override;
QgsProcessingParameterDistance *clone() const override SIP_FACTORY;
QString type() const override;
@ -2573,6 +2597,7 @@ class CORE_EXPORT QgsProcessingParameterArea : public QgsProcessingParameterNumb
QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override;
QString userFriendlyString( const QVariant &value ) const override;
private:
@ -2656,6 +2681,7 @@ class CORE_EXPORT QgsProcessingParameterVolume : public QgsProcessingParameterNu
QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override;
QString userFriendlyString( const QVariant &value ) const override;
private:
@ -2712,6 +2738,7 @@ class CORE_EXPORT QgsProcessingParameterDuration : public QgsProcessingParameter
QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override;
QString userFriendlyString( const QVariant &value ) const override;
private:
@ -2778,6 +2805,7 @@ class CORE_EXPORT QgsProcessingParameterRange : public QgsProcessingParameterDef
* Returns the type name for the parameter class.
*/
static QString typeName() { return QStringLiteral( "range" ); }
QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
QString type() const override { return typeName(); }
bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
@ -2889,6 +2917,8 @@ class CORE_EXPORT QgsProcessingParameterEnum : public QgsProcessingParameterDefi
bool optional = false,
bool usesStaticStrings = false );
QString userFriendlyString( const QVariant &value ) const override;
/**
* Returns the type name for the parameter class.
*/
@ -4090,6 +4120,7 @@ class CORE_EXPORT QgsProcessingParameterColor : public QgsProcessingParameterDef
* Returns the type name for the parameter class.
*/
static QString typeName() { return QStringLiteral( "color" ); }
QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
QString type() const override { return typeName(); }
QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
@ -4373,6 +4404,7 @@ class CORE_EXPORT QgsProcessingParameterDateTime : public QgsProcessingParameter
QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override;
QString userFriendlyString( const QVariant &value ) const override;
/**
* Creates a new parameter using the definition from a script code.

View File

@ -17,6 +17,11 @@
#include "qgsprocessingparametertype.h"
QColor QgsProcessingParameterType::defaultModelColor()
{
return QColor( 128, 128, 128 ); /* mid gray */
}
Qgis::ProcessingParameterTypeFlags QgsProcessingParameterType::flags() const
{
return Qgis::ProcessingParameterTypeFlag::ExposeToModeler;
@ -51,3 +56,8 @@ QList<int> QgsProcessingParameterType::acceptedDataTypes( const QgsProcessingPar
{
return QList<int>();
}
QColor QgsProcessingParameterType::modelColor() const
{
return defaultModelColor();
}

View File

@ -34,6 +34,13 @@ class CORE_EXPORT QgsProcessingParameterType
{
public:
/**
* Returns the default color for a processing parameter.
*
* \since QGIS 4.0
*/
static QColor defaultModelColor();
/**
* Creates a new parameter of this type.
*/
@ -171,6 +178,15 @@ class CORE_EXPORT QgsProcessingParameterType
*/
virtual QList<int> acceptedDataTypes( const QgsProcessingParameterDefinition *parameter ) const;
/**
* Returns the color to use for the parameter in model designer windows.
*
* The default implementation returns defaultModelColor().
*
* \since QGIS 4.0
*/
virtual QColor modelColor() const;
};
#endif // QGSPROCESSINGPARAMETERTYPE_H

View File

@ -97,6 +97,8 @@ class CORE_EXPORT QgsProcessingParameterTypeRasterLayer : public QgsProcessingPa
<< QgsProcessingOutputFile::typeName()
<< QgsProcessingOutputFolder::typeName();
}
QColor modelColor() const override { return QColor( 0, 180, 180 ); /* turquoise */ };
};
/**
@ -169,6 +171,8 @@ class CORE_EXPORT QgsProcessingParameterTypeMeshLayer : public QgsProcessingPara
<< QgsProcessingOutputFile::typeName()
<< QgsProcessingOutputFolder::typeName();
}
QColor modelColor() const override { return QColor( 137, 150, 171 ); /* cold gray */ };
};
/**
@ -250,6 +254,8 @@ class CORE_EXPORT QgsProcessingParameterTypeVectorLayer : public QgsProcessingPa
else
return QList<int>();
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -330,6 +336,8 @@ class CORE_EXPORT QgsProcessingParameterTypeMapLayer : public QgsProcessingParam
<< QgsProcessingOutputFile::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 137, 150, 171 ); /* cold gray */ };
};
/**
@ -421,6 +429,8 @@ class CORE_EXPORT QgsProcessingParameterTypeBoolean : public QgsProcessingParame
<< QgsProcessingOutputVariant::typeName()
<< QgsProcessingOutputBoolean::typeName();
}
QColor modelColor() const override { return QColor( 51, 201, 28 ); /* green */ };
};
/**
@ -493,6 +503,8 @@ class CORE_EXPORT QgsProcessingParameterTypeExpression : public QgsProcessingPar
<< QgsProcessingOutputNumber::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 255, 131, 23 ); /* orange */ };
};
/**
@ -580,6 +592,8 @@ class CORE_EXPORT QgsProcessingParameterTypeCrs : public QgsProcessingParameterT
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 255, 131, 23 ); /* orange */ };
};
/**
@ -646,6 +660,8 @@ class CORE_EXPORT QgsProcessingParameterTypeRange : public QgsProcessingParamete
return QStringList() << QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -714,6 +730,8 @@ class CORE_EXPORT QgsProcessingParameterTypePoint : public QgsProcessingParamete
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -782,6 +800,8 @@ class CORE_EXPORT QgsProcessingParameterTypeGeometry : public QgsProcessingParam
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -851,6 +871,8 @@ class CORE_EXPORT QgsProcessingParameterTypeEnum : public QgsProcessingParameter
<< QgsProcessingOutputVariant::typeName()
<< QgsProcessingOutputNumber::typeName();
}
QColor modelColor() const override { return QColor( 152, 68, 201 ); /* purple */ };
};
/**
@ -935,6 +957,8 @@ class CORE_EXPORT QgsProcessingParameterTypeExtent : public QgsProcessingParamet
<< QgsProcessingOutputMapLayer::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -998,6 +1022,8 @@ class CORE_EXPORT QgsProcessingParameterTypeMatrix : public QgsProcessingParamet
{
return QStringList();
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -1067,6 +1093,8 @@ class CORE_EXPORT QgsProcessingParameterTypeFile : public QgsProcessingParameter
<< QgsProcessingOutputVectorLayer::typeName()
<< QgsProcessingOutputMapLayer::typeName();
}
QColor modelColor() const override { return QColor( 80, 80, 80 ); /* dark gray */ };
};
/**
@ -1224,6 +1252,8 @@ class CORE_EXPORT QgsProcessingParameterTypeVectorDestination : public QgsProces
{
return QStringList() << QObject::tr( "Path for new vector layer" );
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -1300,6 +1330,8 @@ class CORE_EXPORT QgsProcessingParameterTypeFileDestination : public QgsProcessi
<< QgsProcessingOutputVectorLayer::typeName()
<< QgsProcessingOutputMapLayer::typeName();
}
QColor modelColor() const override { return QColor( 80, 80, 80 ); /* dark gray */ };
};
/**
@ -1375,6 +1407,8 @@ class CORE_EXPORT QgsProcessingParameterTypeFolderDestination : public QgsProces
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 80, 80, 80 ); /* dark gray */ };
};
/**
@ -1435,6 +1469,8 @@ class CORE_EXPORT QgsProcessingParameterTypeRasterDestination : public QgsProces
{
return QStringList() << QObject::tr( "Path for new raster layer" );
}
QColor modelColor() const override { return QColor( 0, 180, 180 ); /* turquoise */ };
};
/**
@ -1515,6 +1551,8 @@ class CORE_EXPORT QgsProcessingParameterTypeString : public QgsProcessingParamet
<< QgsProcessingOutputFolder::typeName()
<< QgsProcessingOutputString::typeName();
}
QColor modelColor() const override { return QColor( 255, 131, 23 ); /* orange */ };
};
/**
@ -1652,6 +1690,8 @@ class CORE_EXPORT QgsProcessingParameterTypeMultipleLayers : public QgsProcessin
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 137, 150, 171 ); /* cold gray */ };
};
/**
@ -1735,6 +1775,8 @@ class CORE_EXPORT QgsProcessingParameterTypeFeatureSource : public QgsProcessing
else
return QList<int>();
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -1807,6 +1849,8 @@ class CORE_EXPORT QgsProcessingParameterTypeNumber : public QgsProcessingParamet
<< QgsProcessingOutputVariant::typeName()
<< QgsProcessingOutputString::typeName();
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -1861,6 +1905,8 @@ class CORE_EXPORT QgsProcessingParameterTypeDistance : public QgsProcessingParam
<< QObject::tr( "field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field" )
<< QObject::tr( "expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression" );
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
@ -2027,6 +2073,8 @@ class CORE_EXPORT QgsProcessingParameterTypeDuration : public QgsProcessingParam
<< QObject::tr( "field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field" )
<< QObject::tr( "expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression" );
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -2079,6 +2127,8 @@ class CORE_EXPORT QgsProcessingParameterTypeScale : public QgsProcessingParamete
{
return QStringList() << QObject::tr( "A numeric value representing the scale denominator" );
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -2205,6 +2255,8 @@ class CORE_EXPORT QgsProcessingParameterTypeFeatureSink : public QgsProcessingPa
{
return QStringList() << QObject::tr( "Path for new vector layer" );
}
QColor modelColor() const override { return QColor( 122, 0, 47 ); /* burgundy */ };
};
/**
@ -2404,6 +2456,8 @@ class CORE_EXPORT QgsProcessingParameterTypeColor : public QgsProcessingParamete
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 34, 157, 214 ); /* blue */ };
};
/**
@ -2603,6 +2657,8 @@ class CORE_EXPORT QgsProcessingParameterTypeDateTime : public QgsProcessingParam
<< QgsProcessingOutputString::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 255, 131, 23 ); /* orange */ };
};
/**
@ -2873,6 +2929,8 @@ class CORE_EXPORT QgsProcessingParameterTypePointCloudLayer : public QgsProcessi
<< QgsProcessingOutputFile::typeName()
<< QgsProcessingOutputFolder::typeName();
}
QColor modelColor() const override { return QColor( 137, 150, 171 ); /* cold gray */ };
};
/**
@ -2943,6 +3001,8 @@ class CORE_EXPORT QgsProcessingParameterTypeAnnotationLayer : public QgsProcessi
<< QgsProcessingOutputMapLayer::typeName()
<< QgsProcessingOutputVariant::typeName();
}
QColor modelColor() const override { return QColor( 137, 150, 171 ); /* cold gray */ };
};
/**
@ -3003,6 +3063,8 @@ class CORE_EXPORT QgsProcessingParameterTypePointCloudDestination : public QgsPr
{
return QStringList() << QObject::tr( "Path for new point cloud layer" );
}
QColor modelColor() const override { return QColor( 80, 80, 80 ); /* dark gray */ };
};
/**
@ -3129,6 +3191,8 @@ class CORE_EXPORT QgsProcessingParameterTypeVectorTileDestination : public QgsPr
{
return QStringList() << QObject::tr( "Path for new vector tile layer" );
}
QColor modelColor() const override { return QColor( 80, 80, 80 ); /* dark gray */ };
};
#endif // QGSPROCESSINGPARAMETERTYPEIMPL_H

View File

@ -663,11 +663,11 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), fieldName );
if ( field.editorWidgetSetup().type() == QStringLiteral( "ValueRelation" ) )
if ( field.editorWidgetSetup().type() == QLatin1String( "ValueRelation" ) )
{
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( vlayer->id(), field.name() ), field.editorWidgetSetup().config().value( QStringLiteral( "Value" ) ).toString() );
}
if ( field.editorWidgetSetup().type() == QStringLiteral( "ValueMap" ) )
if ( field.editorWidgetSetup().type() == QLatin1String( "ValueMap" ) )
{
if ( field.editorWidgetSetup().config().value( QStringLiteral( "map" ) ).canConvert<QList<QVariant>>() )
{
@ -4003,11 +4003,11 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
if ( e.isNull() )
{
e = propertiesElem.firstChildElement( QStringLiteral( "properties" ) );
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "Paths" ) )
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QLatin1String( "Paths" ) )
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
e = e.firstChildElement( QStringLiteral( "properties" ) );
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "Absolute" ) )
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QLatin1String( "Absolute" ) )
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
}
else

Some files were not shown because too many files have changed in this diff Show More