Skip to content
Permalink
Browse files

Add relation widget registry

  • Loading branch information
suricactus committed Dec 30, 2020
1 parent 112aaf0 commit 51cd712c76e16333d79795e1631f4485606b53b1
Showing with 3,240 additions and 161 deletions.
  1. +32 −2 python/core/auto_generated/qgsattributeeditorelement.sip.in
  2. +4 −0 python/gui/auto_additions/qgsbasicrelationwidget.py
  3. +36 −3 python/gui/auto_generated/editorwidgets/qgsrelationwidgetwrapper.sip.in
  4. +110 −0 python/gui/auto_generated/qgsbasicrelationwidget.sip.in
  5. +7 −0 python/gui/auto_generated/qgsgui.sip.in
  6. +77 −0 python/gui/auto_generated/qgsrelationconfigwidget.sip.in
  7. +226 −0 python/gui/auto_generated/qgsrelationwidget.sip.in
  8. +75 −0 python/gui/auto_generated/qgsrelationwidgetfactory.sip.in
  9. +81 −0 python/gui/auto_generated/qgsrelationwidgetregistry.sip.in
  10. +5 −0 python/gui/gui_auto.sip
  11. +28 −1 src/core/qgsattributeeditorelement.cpp
  12. +30 −2 src/core/qgsattributeeditorelement.h
  13. +34 −12 src/core/qgseditformconfig.cpp
  14. +14 −0 src/gui/CMakeLists.txt
  15. +36 −19 src/gui/attributeformconfig/qgsattributewidgetedit.cpp
  16. +4 −0 src/gui/attributeformconfig/qgsattributewidgetedit.h
  17. +42 −27 src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
  18. +35 −5 src/gui/editorwidgets/qgsrelationwidgetwrapper.h
  19. +8 −3 src/gui/qgsattributeform.cpp
  20. +1 −0 src/gui/qgsattributeform.h
  21. +57 −0 src/gui/qgsbasicrelationconfigwidget.cpp
  22. +62 −0 src/gui/qgsbasicrelationconfigwidget.h
  23. +558 −0 src/gui/qgsbasicrelationwidget.cpp
  24. +172 −0 src/gui/qgsbasicrelationwidget.h
  25. +46 −0 src/gui/qgsbasicrelationwidgetfactory.cpp
  26. +48 −0 src/gui/qgsbasicrelationwidgetfactory.h
  27. +8 −0 src/gui/qgsgui.cpp
  28. +8 −0 src/gui/qgsgui.h
  29. +37 −0 src/gui/qgsrelationconfigwidget.cpp
  30. +87 −0 src/gui/qgsrelationconfigwidget.h
  31. +595 −0 src/gui/qgsrelationwidget.cpp
  32. +260 −0 src/gui/qgsrelationwidget.h
  33. +24 −0 src/gui/qgsrelationwidgetfactory.cpp
  34. +80 −0 src/gui/qgsrelationwidgetfactory.h
  35. +78 −0 src/gui/qgsrelationwidgetregistry.cpp
  36. +90 −0 src/gui/qgsrelationwidgetregistry.h
  37. +19 −6 src/gui/vector/qgsattributesformproperties.cpp
  38. +6 −1 src/gui/vector/qgsattributesformproperties.h
  39. +50 −80 src/ui/attributeformconfig/qgsattributewidgetrelationeditwidget.ui
  40. +70 −0 src/ui/qgsrelationeditorconfigwidgetbase.ui
@@ -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:
@@ -411,18 +425,24 @@ 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 );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16

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

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

.. versionadded:: 3.16

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

bool forceSuppressFormPopup() const;
@@ -469,6 +489,16 @@ 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
%End

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

};
@@ -0,0 +1,4 @@
# The following has been generated automatically from src/gui/qgsbasicrelationwidget.h
QgsBasicRelationWidget.Button.baseClass = QgsBasicRelationWidget
QgsBasicRelationWidget.Buttons.baseClass = QgsBasicRelationWidget
Buttons = QgsBasicRelationWidget # 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,35 @@ 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 );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16

.. deprecated:: QGIS 3.18
%End

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

.. versionadded:: 3.16

.. deprecated:: QGIS 3.18
%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
%End

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

bool forceSuppressFormPopup() const;
@@ -0,0 +1,110 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsbasicrelationwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsBasicRelationWidget : QgsRelationWidget
{
%Docstring
The default relation widget in QGIS. Successor of the now deprecated {:py:class:`QgsRelationEditorWidget`}.

.. versionadded:: 3.18
%End

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

enum Button
{
Link,
Unlink,
SaveChildEdits,
AddChildFeature,
DuplicateChildFeature,
DeleteChildFeature,
ZoomToChildFeature,
AllButtons
};
typedef QFlags<QgsBasicRelationWidget::Button> Buttons;


QgsBasicRelationWidget( const QVariantMap &config, QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor

:param config: widget configuration
:param parent: parent widget
%End

void setViewMode( QgsDualView::ViewMode mode );
%Docstring
Define the view mode for the dual view
%End

QgsDualView::ViewMode viewMode();
%Docstring
Gets the view mode for the dual view
%End

void setEditorContext( const QgsAttributeEditorContext &context );
%Docstring
Sets the editor ``context``

.. note::

if context cadDockWidget is null, it won't be possible to digitize
the geometry of a referencing feature from this widget
%End

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

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

virtual QVariantMap config() const;

%Docstring
Returns the current configuration
%End

virtual void setConfig( const QVariantMap &config );

%Docstring
Defines the current configuration
%End

virtual void setTitle( const QString &title );

%Docstring
Sets the title of the root groupbox
%End

public slots:
virtual void parentFormValueChanged( const QString &attribute, const QVariant &newValue );


};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsbasicrelationwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -129,6 +129,13 @@ Returns the registry of subset string editors of data providers
%Docstring
Returns the registry of provider source widget providers.

.. versionadded:: 3.18
%End

static QgsRelationWidgetRegistry *relationWidgetRegistry() /KeepReference/;
%Docstring
Returns the global relation widget registry, used for managing all known relation widget factories.

.. versionadded:: 3.18
%End

@@ -0,0 +1,77 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrelationconfigwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/







class QgsRelationConfigWidget : QWidget
{
%Docstring
This class should be subclassed for every configurable relation widget type.

It implements the GUI configuration widget and transforms this to/from a configuration.

It will only be instantiated by {:py:class:`QgsRelationWidgetFactory`}

.. versionadded:: 3.18
%End

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

explicit QgsRelationConfigWidget( const QgsRelation &relation, QWidget *parent /TransferThis/ );
%Docstring
Create a new configuration widget

:param relation: The relation for which the configuration dialog will be created
:param parent: A parent widget
%End

virtual QVariantMap config() = 0;
%Docstring
Create a configuration from the current GUI state

:return: A widget configuration
%End

virtual void setConfig( const QVariantMap &config ) = 0;
%Docstring
Update the configuration widget to represent the given configuration.

:param config: The configuration which should be represented by this widget
%End

QgsVectorLayer *layer();
%Docstring
Returns the layer for which this configuration widget applies

:return: The layer
%End

QgsRelation relation() const;
%Docstring
Returns the relation for which this configuration widget applies

:return: The relation
%End


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrelationconfigwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 51cd712

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