diff --git a/python/3d/3d_auto.sip b/python/3d/3d_auto.sip index f5dc26d12e0..4588f950d23 100644 --- a/python/3d/3d_auto.sip +++ b/python/3d/3d_auto.sip @@ -3,6 +3,7 @@ %Include auto_generated/qgs3d.sip %Include auto_generated/qgs3dmapscene.sip %Include auto_generated/qgs3dmapsettings.sip +%Include auto_generated/qgs3dmaptool.sip %Include auto_generated/qgs3dtypes.sip %Include auto_generated/qgs3dmapcanvas.sip %Include auto_generated/qgsabstractvectorlayer3drenderer.sip diff --git a/python/3d/auto_additions/qgs3dmaptool.py b/python/3d/auto_additions/qgs3dmaptool.py new file mode 100644 index 00000000000..52623d24c95 --- /dev/null +++ b/python/3d/auto_additions/qgs3dmaptool.py @@ -0,0 +1,5 @@ +# The following has been generated automatically from src/3d/qgs3dmaptool.h +try: + Qgs3DMapTool.__virtual_methods__ = ['mousePressEvent', 'mouseReleaseEvent', 'mouseMoveEvent', 'keyPressEvent', 'keyReleaseEvent', 'mouseWheelEvent', 'activate', 'deactivate', 'cursor'] +except (NameError, AttributeError): + pass diff --git a/python/3d/auto_generated/qgs3dmapcanvas.sip.in b/python/3d/auto_generated/qgs3dmapcanvas.sip.in index 83701d9678f..fb3d4dc2027 100644 --- a/python/3d/auto_generated/qgs3dmapcanvas.sip.in +++ b/python/3d/auto_generated/qgs3dmapcanvas.sip.in @@ -58,6 +58,23 @@ scene has not been initialized yet with :py:func:`~Qgs3DMapCanvas.setMapSettings` %End + void setMapTool( Qgs3DMapTool *tool ); +%Docstring +Sets the active map ``tool`` that will receive events from the 3D +canvas. Does not transfer ownership. If the tool is ``None``, events +will be used for camera manipulation. + +.. versionadded:: 4.0 +%End + + Qgs3DMapTool *mapTool() const; +%Docstring +Returns the active map tool that will receive events from the 3D canvas. +If the tool is ``None``, events will be used for camera manipulation. + +.. versionadded:: 4.0 +%End + protected: virtual void showEvent( QShowEvent *e ); diff --git a/python/3d/auto_generated/qgs3dmaptool.sip.in b/python/3d/auto_generated/qgs3dmaptool.sip.in new file mode 100644 index 00000000000..f02962e4170 --- /dev/null +++ b/python/3d/auto_generated/qgs3dmaptool.sip.in @@ -0,0 +1,91 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/qgs3dmaptool.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.py again * + ************************************************************************/ + + + + + + +class Qgs3DMapTool : QObject +{ +%Docstring(signature="appended") +Base class for map tools operating on 3D map canvas. + +.. versionadded:: 4.0 +%End + +%TypeHeaderCode +#include "qgs3dmaptool.h" +%End + public: + Qgs3DMapTool( Qgs3DMapCanvas *canvas ); +%Docstring +Base constructor for a Qgs3DMapTool for the specified ``canvas`` +%End + + virtual void mousePressEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseReleaseEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse release ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseMoveEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse move ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void keyPressEvent( QKeyEvent *event ); +%Docstring +Reimplement to handle key press ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void keyReleaseEvent( QKeyEvent *event ); +%Docstring +Reimplement to handle key release ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseWheelEvent( QWheelEvent *event ); +%Docstring +Reimplement to handle mouse wheel ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + + virtual void activate(); +%Docstring +Called when set as currently active map tool +%End + + virtual void deactivate(); +%Docstring +Called when map tool is being deactivated +%End + + virtual QCursor cursor() const; +%Docstring +Mouse cursor to be used when the tool is active +%End + + Qgs3DMapCanvas *canvas(); +%Docstring +Returns the parent Qgs3DMapCanvas +%End + + protected: +}; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/qgs3dmaptool.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.py again * + ************************************************************************/ diff --git a/python/PyQt6/3d/3d_auto.sip b/python/PyQt6/3d/3d_auto.sip index f5dc26d12e0..4588f950d23 100644 --- a/python/PyQt6/3d/3d_auto.sip +++ b/python/PyQt6/3d/3d_auto.sip @@ -3,6 +3,7 @@ %Include auto_generated/qgs3d.sip %Include auto_generated/qgs3dmapscene.sip %Include auto_generated/qgs3dmapsettings.sip +%Include auto_generated/qgs3dmaptool.sip %Include auto_generated/qgs3dtypes.sip %Include auto_generated/qgs3dmapcanvas.sip %Include auto_generated/qgsabstractvectorlayer3drenderer.sip diff --git a/python/PyQt6/3d/auto_additions/qgs3dmaptool.py b/python/PyQt6/3d/auto_additions/qgs3dmaptool.py new file mode 100644 index 00000000000..52623d24c95 --- /dev/null +++ b/python/PyQt6/3d/auto_additions/qgs3dmaptool.py @@ -0,0 +1,5 @@ +# The following has been generated automatically from src/3d/qgs3dmaptool.h +try: + Qgs3DMapTool.__virtual_methods__ = ['mousePressEvent', 'mouseReleaseEvent', 'mouseMoveEvent', 'keyPressEvent', 'keyReleaseEvent', 'mouseWheelEvent', 'activate', 'deactivate', 'cursor'] +except (NameError, AttributeError): + pass diff --git a/python/PyQt6/3d/auto_generated/qgs3dmapcanvas.sip.in b/python/PyQt6/3d/auto_generated/qgs3dmapcanvas.sip.in index 83701d9678f..fb3d4dc2027 100644 --- a/python/PyQt6/3d/auto_generated/qgs3dmapcanvas.sip.in +++ b/python/PyQt6/3d/auto_generated/qgs3dmapcanvas.sip.in @@ -58,6 +58,23 @@ scene has not been initialized yet with :py:func:`~Qgs3DMapCanvas.setMapSettings` %End + void setMapTool( Qgs3DMapTool *tool ); +%Docstring +Sets the active map ``tool`` that will receive events from the 3D +canvas. Does not transfer ownership. If the tool is ``None``, events +will be used for camera manipulation. + +.. versionadded:: 4.0 +%End + + Qgs3DMapTool *mapTool() const; +%Docstring +Returns the active map tool that will receive events from the 3D canvas. +If the tool is ``None``, events will be used for camera manipulation. + +.. versionadded:: 4.0 +%End + protected: virtual void showEvent( QShowEvent *e ); diff --git a/python/PyQt6/3d/auto_generated/qgs3dmaptool.sip.in b/python/PyQt6/3d/auto_generated/qgs3dmaptool.sip.in new file mode 100644 index 00000000000..f02962e4170 --- /dev/null +++ b/python/PyQt6/3d/auto_generated/qgs3dmaptool.sip.in @@ -0,0 +1,91 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/qgs3dmaptool.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.py again * + ************************************************************************/ + + + + + + +class Qgs3DMapTool : QObject +{ +%Docstring(signature="appended") +Base class for map tools operating on 3D map canvas. + +.. versionadded:: 4.0 +%End + +%TypeHeaderCode +#include "qgs3dmaptool.h" +%End + public: + Qgs3DMapTool( Qgs3DMapCanvas *canvas ); +%Docstring +Base constructor for a Qgs3DMapTool for the specified ``canvas`` +%End + + virtual void mousePressEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseReleaseEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse release ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseMoveEvent( QMouseEvent *event ); +%Docstring +Reimplement to handle mouse move ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void keyPressEvent( QKeyEvent *event ); +%Docstring +Reimplement to handle key press ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void keyReleaseEvent( QKeyEvent *event ); +%Docstring +Reimplement to handle key release ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + virtual void mouseWheelEvent( QWheelEvent *event ); +%Docstring +Reimplement to handle mouse wheel ``event`` forwarded by the parent +Qgs3DMapCanvas +%End + + virtual void activate(); +%Docstring +Called when set as currently active map tool +%End + + virtual void deactivate(); +%Docstring +Called when map tool is being deactivated +%End + + virtual QCursor cursor() const; +%Docstring +Mouse cursor to be used when the tool is active +%End + + Qgs3DMapCanvas *canvas(); +%Docstring +Returns the parent Qgs3DMapCanvas +%End + + protected: +}; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/3d/qgs3dmaptool.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.py again * + ************************************************************************/ diff --git a/src/3d/qgs3dmapcanvas.h b/src/3d/qgs3dmapcanvas.h index daeaa0845d5..c1091a45101 100644 --- a/src/3d/qgs3dmapcanvas.h +++ b/src/3d/qgs3dmapcanvas.h @@ -95,6 +95,20 @@ class _3D_EXPORT Qgs3DMapCanvas : public QWindow //! Returns access to the view's camera controller. Returns NULLPTR if the scene has not been initialized yet with setMapSettings() QgsCameraController *cameraController(); + /** + * Sets the active map \a tool that will receive events from the 3D canvas. Does not transfer ownership. + * If the tool is NULLPTR, events will be used for camera manipulation. + * \since QGIS 4.0 + */ + void setMapTool( Qgs3DMapTool *tool ); + + /** + * Returns the active map tool that will receive events from the 3D canvas. + * If the tool is NULLPTR, events will be used for camera manipulation. + * \since QGIS 4.0 + */ + Qgs3DMapTool *mapTool() const { return mMapTool; } + #ifndef SIP_RUN /** @@ -134,18 +148,6 @@ class _3D_EXPORT Qgs3DMapCanvas : public QWindow //! Saves the current scene as an image void saveAsImage( const QString &fileName, const QString &fileFormat ); - /** - * Sets the active map \a tool that will receive events from the 3D canvas. Does not transfer ownership. - * If the tool is NULLPTR, events will be used for camera manipulation. - */ - void setMapTool( Qgs3DMapTool *tool ); - - /** - * Returns the active map tool that will receive events from the 3D canvas. - * If the tool is NULLPTR, events will be used for camera manipulation. - */ - Qgs3DMapTool *mapTool() const { return mMapTool; } - /** * Returns the 3D engine. */ diff --git a/src/3d/qgs3dmaptool.h b/src/3d/qgs3dmaptool.h index 0d03911af9c..b98883259a4 100644 --- a/src/3d/qgs3dmaptool.h +++ b/src/3d/qgs3dmaptool.h @@ -25,14 +25,11 @@ class QMouseEvent; class QKeyEvent; class QWheelEvent; -#define SIP_NO_FILE - /** * \ingroup qgis_3d * \brief Base class for map tools operating on 3D map canvas. - * \note Not available in Python bindings - * \since QGIS 3.36 (since QGIS 3.4 in QGIS_APP library) + * \since QGIS 4.0 (since QGIS 3.36 in QGIS_3D library, since QGIS 3.4 in QGIS_APP library) */ class _3D_EXPORT Qgs3DMapTool : public QObject {