Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create QgsCalloutPanelWidget #58105

Merged
merged 5 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Create a callout of this type given the map of ``properties``.
Ownership of the callout is transferred to the caller.
%End

virtual QgsCalloutWidget *createCalloutWidget( QgsVectorLayer * );
virtual QgsCalloutWidget *createCalloutWidget( QgsMapLayer * );
%Docstring
Creates a widget for configuring callouts of this type. Can return ``None`` if there's no GUI required.

Expand Down Expand Up @@ -103,7 +103,7 @@ Convenience metadata class that uses static functions to create callouts and the

virtual QgsCallout *createCallout( const QVariantMap &properties, const QgsReadWriteContext &context ) /Factory/;

virtual QgsCalloutWidget *createCalloutWidget( QgsVectorLayer *vl ) /Factory/;
virtual QgsCalloutWidget *createCalloutWidget( QgsMapLayer *vl ) /Factory/;


protected:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/callouts/qgscalloutpanelwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsCalloutPanelWidget : QgsPanelWidget
{
%Docstring(signature="appended")
A panel widget for configuration of callouts.

.. versionadded:: 3.40
%End

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

QgsCalloutPanelWidget( QWidget *parent /TransferThis/ = 0, QgsMapLayer *layer = 0 );
%Docstring
Constructor for QgsCalloutPanelWidget, with the specified ``parent`` widget

The optional ``layer`` argument can be set to an associated map layer.
%End

void setGeometryType( Qgis::GeometryType type );
%Docstring
Sets the geometry ``type`` for the objects associated with the callouts.

If ``type`` is :py:class:`Qgis`.GeometryType.Unknown then an attempt will be made to
deduce the type from the associated map layer.

.. seealso:: :py:func:`geometryType`
%End

Qgis::GeometryType geometryType() const;
%Docstring
Returns the geometry type for the objects associated with the callouts.

If the type is :py:class:`Qgis`.GeometryType.Unknown then an attempt will be made to
deduce the type from the associated map layer.

.. seealso:: :py:func:`setGeometryType`
%End

void setContext( const QgsSymbolWidgetContext &context );
%Docstring
Sets the ``context`` in which the widget is shown, e.g., the associated map canvas and expression contexts.

.. seealso:: :py:func:`context`
%End

QgsSymbolWidgetContext context() const;
%Docstring
Returns the context in which the widget is shown, e.g., the associated map canvas and expression contexts.

.. seealso:: :py:func:`setContext`
%End

void setCallout( const QgsCallout *callout );
%Docstring
Sets the widget state to match the specified ``callout``.

Ownership is not transferred.

.. seealso:: :py:func:`callout`
%End

QgsCallout *callout() /Factory/;
%Docstring
Returns a new callout, respecting the configuration from the widget.

.. seealso:: :py:func:`setCallout`
%End

signals:

void calloutChanged();
%Docstring
Emitted when the callout defined by the widget changes
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/callouts/qgscalloutpanelwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
18 changes: 14 additions & 4 deletions python/PyQt6/gui/auto_generated/callouts/qgscalloutwidget.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Base class for widgets which allow control over the properties of callouts.
%End
public:

QgsCalloutWidget( QWidget *parent /TransferThis/, QgsVectorLayer *vl = 0 );
QgsCalloutWidget( QWidget *parent /TransferThis/, QgsMapLayer *vl = 0 );
%Docstring
Constructor for QgsCalloutWidget.

:param vl: associated vector layer
:param vl: associated map layer
:param parent: parent widget
%End

virtual void setCallout( QgsCallout *callout ) = 0;
virtual void setCallout( const QgsCallout *callout ) = 0;
%Docstring
Sets the ``callout`` to show in the widget. Ownership is not transferred.

Expand Down Expand Up @@ -60,9 +60,19 @@ Returns the context in which the symbol widget is shown, e.g., the associated ma
.. seealso:: :py:func:`setContext`
%End

const QgsVectorLayer *vectorLayer() const;
const QgsVectorLayer *vectorLayer() const /Deprecated/;
%Docstring
Returns the vector layer associated with the widget.

.. deprecated::
QGIS 3.40, use :py:func:`~QgsCalloutWidget.layer` instead.
%End

const QgsMapLayer *layer() const;
%Docstring
Returns the vector layer associated with the widget.

.. versionadded:: 3.40
%End

virtual void setGeometryType( Qgis::GeometryType type ) = 0;
Expand Down
1 change: 1 addition & 0 deletions python/PyQt6/gui/auto_generated/qgsgui.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Returns the screen at the given global ``point`` (pixel).




signals:

void optionsChanged();
Expand Down
1 change: 1 addition & 0 deletions python/PyQt6/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
%Include auto_generated/auth/qgsauthsslerrorsdialog.sip
%Include auto_generated/auth/qgsauthsslimportdialog.sip
%Include auto_generated/auth/qgsauthtrustedcasdialog.sip
%Include auto_generated/callouts/qgscalloutpanelwidget.sip
%Include auto_generated/callouts/qgscalloutwidget.sip
%If ( HAVE_QSCI_SIP )
%Include auto_generated/codeeditors/qgscodeeditor.sip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Create a callout of this type given the map of ``properties``.
Ownership of the callout is transferred to the caller.
%End

virtual QgsCalloutWidget *createCalloutWidget( QgsVectorLayer * );
virtual QgsCalloutWidget *createCalloutWidget( QgsMapLayer * );
%Docstring
Creates a widget for configuring callouts of this type. Can return ``None`` if there's no GUI required.

Expand Down Expand Up @@ -103,7 +103,7 @@ Convenience metadata class that uses static functions to create callouts and the

virtual QgsCallout *createCallout( const QVariantMap &properties, const QgsReadWriteContext &context ) /Factory/;

virtual QgsCalloutWidget *createCalloutWidget( QgsVectorLayer *vl ) /Factory/;
virtual QgsCalloutWidget *createCalloutWidget( QgsMapLayer *vl ) /Factory/;


protected:
Expand Down
97 changes: 97 additions & 0 deletions python/gui/auto_generated/callouts/qgscalloutpanelwidget.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/callouts/qgscalloutpanelwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsCalloutPanelWidget : QgsPanelWidget
{
%Docstring(signature="appended")
A panel widget for configuration of callouts.

.. versionadded:: 3.40
%End

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

QgsCalloutPanelWidget( QWidget *parent /TransferThis/ = 0, QgsMapLayer *layer = 0 );
%Docstring
Constructor for QgsCalloutPanelWidget, with the specified ``parent`` widget

The optional ``layer`` argument can be set to an associated map layer.
%End

void setGeometryType( Qgis::GeometryType type );
%Docstring
Sets the geometry ``type`` for the objects associated with the callouts.

If ``type`` is :py:class:`Qgis`.GeometryType.Unknown then an attempt will be made to
deduce the type from the associated map layer.

.. seealso:: :py:func:`geometryType`
%End

Qgis::GeometryType geometryType() const;
%Docstring
Returns the geometry type for the objects associated with the callouts.

If the type is :py:class:`Qgis`.GeometryType.Unknown then an attempt will be made to
deduce the type from the associated map layer.

.. seealso:: :py:func:`setGeometryType`
%End

void setContext( const QgsSymbolWidgetContext &context );
%Docstring
Sets the ``context`` in which the widget is shown, e.g., the associated map canvas and expression contexts.

.. seealso:: :py:func:`context`
%End

QgsSymbolWidgetContext context() const;
%Docstring
Returns the context in which the widget is shown, e.g., the associated map canvas and expression contexts.

.. seealso:: :py:func:`setContext`
%End

void setCallout( const QgsCallout *callout );
%Docstring
Sets the widget state to match the specified ``callout``.

Ownership is not transferred.

.. seealso:: :py:func:`callout`
%End

QgsCallout *callout() /Factory/;
%Docstring
Returns a new callout, respecting the configuration from the widget.

.. seealso:: :py:func:`setCallout`
%End

signals:

void calloutChanged();
%Docstring
Emitted when the callout defined by the widget changes
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/callouts/qgscalloutpanelwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
18 changes: 14 additions & 4 deletions python/gui/auto_generated/callouts/qgscalloutwidget.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Base class for widgets which allow control over the properties of callouts.
%End
public:

QgsCalloutWidget( QWidget *parent /TransferThis/, QgsVectorLayer *vl = 0 );
QgsCalloutWidget( QWidget *parent /TransferThis/, QgsMapLayer *vl = 0 );
%Docstring
Constructor for QgsCalloutWidget.

:param vl: associated vector layer
:param vl: associated map layer
:param parent: parent widget
%End

virtual void setCallout( QgsCallout *callout ) = 0;
virtual void setCallout( const QgsCallout *callout ) = 0;
%Docstring
Sets the ``callout`` to show in the widget. Ownership is not transferred.

Expand Down Expand Up @@ -60,9 +60,19 @@ Returns the context in which the symbol widget is shown, e.g., the associated ma
.. seealso:: :py:func:`setContext`
%End

const QgsVectorLayer *vectorLayer() const;
const QgsVectorLayer *vectorLayer() const /Deprecated/;
%Docstring
Returns the vector layer associated with the widget.

.. deprecated::
QGIS 3.40, use :py:func:`~QgsCalloutWidget.layer` instead.
%End

const QgsMapLayer *layer() const;
%Docstring
Returns the vector layer associated with the widget.

.. versionadded:: 3.40
%End

virtual void setGeometryType( Qgis::GeometryType type ) = 0;
Expand Down
1 change: 1 addition & 0 deletions python/gui/auto_generated/qgsgui.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Returns the screen at the given global ``point`` (pixel).




signals:

void optionsChanged();
Expand Down
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
%Include auto_generated/auth/qgsauthsslerrorsdialog.sip
%Include auto_generated/auth/qgsauthsslimportdialog.sip
%Include auto_generated/auth/qgsauthtrustedcasdialog.sip
%Include auto_generated/callouts/qgscalloutpanelwidget.sip
%Include auto_generated/callouts/qgscalloutwidget.sip
%If ( HAVE_QSCI_SIP )
%Include auto_generated/codeeditors/qgscodeeditor.sip
Expand Down
4 changes: 2 additions & 2 deletions src/core/callouts/qgscalloutsregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// QgsCalloutAbstractMetadata
//

QgsCalloutWidget *QgsCalloutAbstractMetadata::createCalloutWidget( QgsVectorLayer * )
QgsCalloutWidget *QgsCalloutAbstractMetadata::createCalloutWidget( QgsMapLayer * )
{
return nullptr;
}
Expand All @@ -36,7 +36,7 @@ QgsCallout *QgsCalloutMetadata::createCallout( const QVariantMap &properties, co
return mCreateFunc ? mCreateFunc( properties, context ) : nullptr;
}

QgsCalloutWidget *QgsCalloutMetadata::createCalloutWidget( QgsVectorLayer *vl )
QgsCalloutWidget *QgsCalloutMetadata::createCalloutWidget( QgsMapLayer *vl )
{
return mWidgetFunc ? mWidgetFunc( vl ) : nullptr;
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/callouts/qgscalloutsregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <QIcon>

class QgsPathResolver;
class QgsVectorLayer;
class QgsMapLayer;
class QgsCalloutWidget SIP_EXTERNAL;
class QgsCallout;
class QDomElement;
Expand Down Expand Up @@ -91,7 +91,7 @@ class CORE_EXPORT QgsCalloutAbstractMetadata
*
* Ownership of the widget is transferred to the caller.
*/
virtual QgsCalloutWidget *createCalloutWidget( QgsVectorLayer * );
virtual QgsCalloutWidget *createCalloutWidget( QgsMapLayer * );

protected:
QString mName;
Expand All @@ -100,7 +100,7 @@ class CORE_EXPORT QgsCalloutAbstractMetadata
};

typedef QgsCallout *( *QgsCalloutCreateFunc )( const QVariantMap &, const QgsReadWriteContext & ) SIP_SKIP;
typedef QgsCalloutWidget *( *QgsCalloutWidgetFunc )( QgsVectorLayer * ) SIP_SKIP;
typedef QgsCalloutWidget *( *QgsCalloutWidgetFunc )( QgsMapLayer * ) SIP_SKIP;

/**
* \ingroup core
Expand Down Expand Up @@ -130,7 +130,7 @@ class CORE_EXPORT QgsCalloutMetadata : public QgsCalloutAbstractMetadata
void setWidgetFunction( QgsCalloutWidgetFunc f ) { mWidgetFunc = f; } SIP_SKIP

QgsCallout *createCallout( const QVariantMap &properties, const QgsReadWriteContext &context ) override SIP_FACTORY;
QgsCalloutWidget *createCalloutWidget( QgsVectorLayer *vl ) override SIP_FACTORY;
QgsCalloutWidget *createCalloutWidget( QgsMapLayer *vl ) override SIP_FACTORY;

protected:
QgsCalloutCreateFunc mCreateFunc;
Expand Down
Loading
Loading