Skip to content

Commit

Permalink
Merge pull request #40721 from suricactus/relregistry
Browse files Browse the repository at this point in the history
Support multiple relation editors via relation widget registry
  • Loading branch information
3nids committed Jan 8, 2021
2 parents 6061030 + 6620bb9 commit 0fc4aee
Show file tree
Hide file tree
Showing 32 changed files with 2,598 additions and 1,260 deletions.
102 changes: 28 additions & 74 deletions python/core/auto_generated/qgsattributeeditorelement.sip.in
Expand Up @@ -113,6 +113,20 @@ Controls if this element should be labeled with a title (field, relation or grou
Controls if this element should be labeled with a title (field, relation or groupname).

.. versionadded:: 2.18
%End

QVariantMap config() const;
%Docstring
Returns the editor configuration

.. versionadded:: 3.18
%End

void setConfig( const QVariantMap &config );
%Docstring
Sets the editor configuration

.. versionadded:: 3.18
%End

protected:
Expand Down Expand Up @@ -351,80 +365,6 @@ Initializes the relation from the id
virtual QgsAttributeEditorElement *clone( QgsAttributeEditorElement *parent ) const /Factory/;


bool showLinkButton() const /Deprecated/;
%Docstring
Determines if the "link feature" button should be shown

.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use visibleButtons() instead
%End

void setShowLinkButton( bool showLinkButton ) /Deprecated/;
%Docstring
Determines if the "link feature" button should be shown

.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setVisibleButtons() instead
%End

bool showUnlinkButton() const /Deprecated/;
%Docstring
Determines if the "unlink feature" button should be shown

.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use visibleButtons() instead
%End

void setShowUnlinkButton( bool showUnlinkButton ) /Deprecated/;
%Docstring
Determines if the "unlink feature" button should be shown

.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setVisibleButtons() instead
%End

void setShowSaveChildEditsButton( bool showChildEdits ) /Deprecated/;
%Docstring
Determines if the "Save child layer edits" button should be shown

.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use setVisibleButtons() instead
%End

bool showSaveChildEditsButton() const /Deprecated/;
%Docstring
Determines if the "Save child layer edits" button should be shown

.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use visibleButtons() instead
%End

void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16
%End

QgsAttributeEditorRelation::Buttons visibleButtons() const;
%Docstring
Returns the buttons which are shown

.. versionadded:: 3.16
%End

bool forceSuppressFormPopup() const;
%Docstring
Determines the force suppress form popup status.
Expand Down Expand Up @@ -469,6 +409,20 @@ Sets ``label`` for this element
If it's empty it takes the relation id as label

.. versionadded:: 3.16
%End

QString relationWidgetTypeId() const;
%Docstring
Returns the current relation widget type id

.. versionadded:: 3.18
%End

void setRelationWidgetTypeId( const QString &relationWidgetTypeId );
%Docstring
Sets the relation widget type

.. versionadded:: 3.18
%End

};
Expand Down
4 changes: 4 additions & 0 deletions python/gui/auto_additions/qgsrelationeditorwidget.py
@@ -0,0 +1,4 @@
# The following has been generated automatically from src/gui/qgsrelationeditorwidget.h
QgsRelationEditorWidget.Button.baseClass = QgsRelationEditorWidget
QgsRelationEditorWidget.Buttons.baseClass = QgsRelationEditorWidget
Buttons = QgsRelationEditorWidget # dirty hack since SIP seems to introduce the flags in module
Expand Up @@ -18,7 +18,23 @@ class QgsRelationWidgetWrapper : QgsWidgetWrapper
%End
public:

explicit QgsRelationWidgetWrapper( QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor = 0, QWidget *parent /TransferThis/ = 0 );
QgsRelationWidgetWrapper(
QgsVectorLayer *vl,
const QgsRelation &relation,
QWidget *editor /Constrained/ = 0,
QWidget *parent /TransferThis,Constrained/ = 0
);
%Docstring
Constructor for QgsRelationWidgetWrapper
%End

QgsRelationWidgetWrapper(
const QString &relationEditorName,
QgsVectorLayer *vl,
const QgsRelation &relation,
QWidget *editor = 0,
QWidget *parent /TransferThis/ = 0
);
%Docstring
Constructor for QgsRelationWidgetWrapper
%End
Expand Down Expand Up @@ -99,18 +115,41 @@ Determines if the "Save child layer edits" button should be shown
use visibleButtons() instead
%End

void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons ) /Deprecated/;
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16

.. deprecated:: QGIS 3.18
use setWidgetConfig() instead
%End

QgsAttributeEditorRelation::Buttons visibleButtons() const;
QgsAttributeEditorRelation::Buttons visibleButtons() const /Deprecated/;
%Docstring
Returns the buttons which are shown

.. versionadded:: 3.16

.. deprecated:: QGIS 3.18
use widgetConfig() instead
%End


void setWidgetConfig( const QVariantMap &config );
%Docstring
Will set the config of this widget wrapper to the specified config.

:param config: The config for this wrapper

.. versionadded:: 3.18
%End

QVariantMap widgetConfig() const;
%Docstring
Returns the whole widget config

.. versionadded:: 3.18
%End

bool forceSuppressFormPopup() const;
Expand Down

0 comments on commit 0fc4aee

Please sign in to comment.