Skip to content
Permalink
Browse files

Merge pull request #40721 from suricactus/relregistry

Support multiple relation editors via relation widget registry
  • Loading branch information
3nids committed Jan 8, 2021
2 parents 6061030 + 6620bb9 commit 0fc4aee6128e063088f1568098d234bfa4b8ce4f
Showing with 2,598 additions and 1,260 deletions.
  1. +28 −74 python/core/auto_generated/qgsattributeeditorelement.sip.in
  2. +4 −0 python/gui/auto_additions/qgsrelationeditorwidget.py
  3. +42 −3 python/gui/auto_generated/editorwidgets/qgsrelationwidgetwrapper.sip.in
  4. +340 −0 python/gui/auto_generated/qgsabstractrelationeditorwidget.sip.in
  5. +7 −0 python/gui/auto_generated/qgsgui.sip.in
  6. +72 −131 python/gui/auto_generated/qgsrelationeditorwidget.sip.in
  7. +81 −0 python/gui/auto_generated/qgsrelationwidgetregistry.sip.in
  8. +2 −0 python/gui/gui_auto.sip
  9. +28 −36 src/core/qgsattributeeditorelement.cpp
  10. +28 −54 src/core/qgsattributeeditorelement.h
  11. +31 −12 src/core/qgseditformconfig.cpp
  12. +4 −0 src/gui/CMakeLists.txt
  13. +33 −18 src/gui/attributeformconfig/qgsattributewidgetedit.cpp
  14. +4 −0 src/gui/attributeformconfig/qgsattributewidgetedit.h
  15. +44 −29 src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
  16. +37 −5 src/gui/editorwidgets/qgsrelationwidgetwrapper.h
  17. +598 −0 src/gui/qgsabstractrelationeditorwidget.cpp
  18. +383 −0 src/gui/qgsabstractrelationeditorwidget.h
  19. +9 −4 src/gui/qgsattributeform.cpp
  20. +2 −1 src/gui/qgsattributeform.h
  21. +8 −0 src/gui/qgsgui.cpp
  22. +8 −0 src/gui/qgsgui.h
  23. +238 −633 src/gui/qgsrelationeditorwidget.cpp
  24. +124 −173 src/gui/qgsrelationeditorwidget.h
  25. +76 −0 src/gui/qgsrelationwidgetregistry.cpp
  26. +87 −0 src/gui/qgsrelationwidgetregistry.h
  27. +19 −6 src/gui/vector/qgsattributesformproperties.cpp
  28. +6 −1 src/gui/vector/qgsattributesformproperties.h
  29. +50 −80 src/ui/attributeformconfig/qgsattributewidgetrelationeditwidget.ui
  30. +70 −0 src/ui/qgsrelationeditorconfigwidgetbase.ui
  31. +1 −0 tests/src/python/CMakeLists.txt
  32. +134 −0 tests/src/python/test_qgsrelationeditorwidgetregistry.py
@@ -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:
@@ -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.
@@ -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

};
@@ -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
@@ -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
@@ -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;

0 comments on commit 0fc4aee

Please sign in to comment.
You can’t perform that action at this time.