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

Support multiple relation editors via relation widget registry #40721

Merged
merged 23 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
51cd712
Add relation widget registry
suricactus Dec 18, 2020
b1dad1d
Added SIP_DEPRECATED and added forgotten \since docs
suricactus Dec 22, 2020
19d398e
Restore a tooltip replaced during debugging
suricactus Dec 22, 2020
1151a8f
Open the correct configuration widget
suricactus Dec 30, 2020
c3411b9
Not sure why this was like this in the original QgsRelationEditorWidget
suricactus Dec 31, 2020
01fd983
Fix adding new features
suricactus Dec 31, 2020
4c463d3
Revert "Not sure why this was like this in the original QgsRelationEd…
suricactus Jan 4, 2021
e892bee
Update the UI when the root collapsible box is opened
suricactus Jan 4, 2021
95300c9
declare setupRelationWidgetWrapper with 2 args as deprecated
suricactus Jan 4, 2021
10b2b3b
mRelationEditorName -> mRelationEditorId
suricactus Jan 6, 2021
ca56fe6
Remove from the layout, just in case
suricactus Jan 6, 2021
415ecc4
Rename the "basic" widget to "relation_editor" widget
suricactus Jan 6, 2021
8f4bf3e
SIP convert
suricactus Jan 6, 2021
4726985
Single QgsBasicRelationWidget file
suricactus Jan 6, 2021
891c89a
rename QgsBasicRelationWidget--> QgsRelationEditorWidget
suricactus Jan 6, 2021
bb7f411
Rename to Abstract prefix
suricactus Jan 7, 2021
e786da8
Add test for the relation widget registry
suricactus Jan 7, 2021
5d47b5d
Convert cpp type to python type
suricactus Jan 7, 2021
71baf2b
Make it Q_OBJECT
suricactus Jan 8, 2021
a544834
No more Q_NOWARN_DEPRECATED_POP
suricactus Jan 8, 2021
ebddedd
Fix wrong usage of mFeatureSelectionMgr in the abstract class
suricactus Jan 8, 2021
7708569
Fix breaking tests
suricactus Jan 8, 2021
6620bb9
Removed the deprecated methods, will be implemented in Python only
suricactus Jan 8, 2021
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
102 changes: 28 additions & 74 deletions python/core/auto_generated/qgsattributeeditorelement.sip.in
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Loading