1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsabstractrelationeditorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
// this is needed for the "convert to subclass" code below to compile
%ModuleHeaderCode
#include "qgsrelationeditorwidget.h"
%End
class QgsAbstractRelationEditorWidget : QWidget
{
%Docstring(signature="appended")
Base class to build new relation widgets.
.. versionadded:: 3.18
%End
%TypeHeaderCode
#include "qgsabstractrelationeditorwidget.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) )
sipType = sipType_QgsRelationEditorWidget;
else
sipType = 0;
%End
public:
QgsAbstractRelationEditorWidget( const QVariantMap &config, QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor
%End
void setRelationFeature( const QgsRelation &relation, const QgsFeature &feature );
%Docstring
Sets the ``relation`` and the ``feature``
%End
void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation );
%Docstring
Sets the relation(s) for this widget
If only one relation is set, it will act as a simple 1:N relation widget
If both relations are set, it will act as an N:M relation widget
inserting and deleting entries on the intermediate table as required.
:param relation: Relation referencing the edited table
:param nmrelation: Optional reference from the referencing table to a 3rd N:M table
%End
QgsRelation relation() const;
%Docstring
Returns the relation
.. versionadded:: 3.18
%End
QgsRelation nmRelation() const;
%Docstring
Returns the nm relation
.. versionadded:: 3.18
%End
void setFeature( const QgsFeature &feature, bool update = true );
%Docstring
Sets the ``feature`` being edited and updates the UI unless ``update`` is set to ``False``
%End
virtual 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
QgsAttributeEditorContext editorContext( ) const;
%Docstring
Returns the attribute editor context.
%End
bool showLabel() const /Deprecated/;
%Docstring
Defines if a title label should be shown for this widget.
.. deprecated:: QGIS 3.20
label is handled directly in :py:class:`QgsAttributeForm`.
%End
void setShowLabel( bool showLabel ) /Deprecated/;
%Docstring
Defines if a title label should be shown for this widget.
.. deprecated:: QGIS 3.20
label is handled directly in :py:class:`QgsAttributeForm`.
%End
QVariant nmRelationId() const;
%Docstring
Determines the relation id of the second relation involved in an N:M relation.
%End
void setNmRelationId( const QVariant &nmRelationId = QVariant() );
%Docstring
Sets ``nmRelationId`` for the relation id of the second relation involved in an N:M relation.
If it's empty, then it's considered as a 1:M relationship.
%End
QString label() const /Deprecated/;
%Docstring
Determines the label of this element
.. deprecated:: QGIS 3.20
label is handled directly in :py:class:`QgsAttributeForm`.
%End
void setLabel( const QString &label = QString() );
%Docstring
Sets ``label`` for this element
If it's empty it takes the relation id as label
%End
QgsFeature feature() const;
%Docstring
Returns the widget's current feature
%End
bool forceSuppressFormPopup() const;
%Docstring
Determines the force suppress form popup status that is configured for this widget
%End
void setForceSuppressFormPopup( bool forceSuppressFormPopup );
%Docstring
Sets force suppress form popup status with ``forceSuppressFormPopup``
configured for this widget
%End
virtual QVariantMap config() const = 0;
%Docstring
Returns the widget configuration
%End
virtual void setConfig( const QVariantMap &config ) = 0;
%Docstring
Defines the widget configuration
%End
signals:
void relatedFeaturesChanged();
%Docstring
Emit this signal, whenever the related features changed.
This happens for example when related features are added, removed,
linked or unlinked.
.. versionadded:: 3.22
%End
public slots:
virtual void parentFormValueChanged( const QString &attribute, const QVariant &newValue ) = 0;
%Docstring
Called when an ``attribute`` value in the parent widget has changed to ``newValue``
%End
protected slots:
void toggleEditing( bool state );
%Docstring
Toggles editing state of the widget
%End
void saveEdits();
%Docstring
Saves the current modifications in the relation
%End
void addFeature( const QgsGeometry &geometry = QgsGeometry() );
%Docstring
Adds a new feature with given ``geometry``
%End
void deleteFeature( QgsFeatureId fid = QgsFeatureId() );
%Docstring
Delete a feature with given ``fid``
%End
void linkFeature();
%Docstring
Links a new feature to the relation
%End
void onLinkFeatureDlgAccepted();
%Docstring
Called when the link feature dialog is confirmed by the user
%End
void unlinkFeature( QgsFeatureId fid = QgsFeatureId() );
%Docstring
Unlinks a feature with given ``fid``
%End
void duplicateFeature( const QgsFeatureId &fid );
%Docstring
Duplicates a feature
%End
void duplicateFeatures( const QgsFeatureIds &fids );
%Docstring
Duplicates features
%End
protected:
void showEvent( QShowEvent * );
%Docstring
Refresh the UI when the widget becomes visible
%End
void updateTitle() /Deprecated/;
%Docstring
Updates the title contents to reflect the current state of the widget
.. deprecated:: QGIS 3.20
label is handled directly in :py:class:`QgsAttributeForm`.
%End
void deleteFeatures( const QgsFeatureIds &fids );
%Docstring
Deletes the features with ``fids``
%End
void unlinkFeatures( const QgsFeatureIds &fids );
%Docstring
Unlinks the features with ``fids``
%End
virtual void updateUi();
%Docstring
A hook called every time the state of the relation editor widget has changed via calling its `set*` methods or slots,
e.g. changed relation, added feature, etc.
Should be used to refresh the UI regarding the new data.
Check :py:class:`QgsRealationEditorWidget` as an example.
%End
virtual void setTitle( const QString &title ) /Deprecated/;
%Docstring
Sets the title of the widget, if it is wrapped within a :py:class:`QgsCollapsibleGroupBox`
.. deprecated:: QGIS 3.20
label is handled directly in :py:class:`QgsAttributeForm`.
%End
virtual void beforeSetRelationFeature( const QgsRelation &newRelation, const QgsFeature &newFeature );
%Docstring
A hook called right before :py:func:`~QgsAbstractRelationEditorWidget.setRelationFeature` is executed. Used to update the UI once setting the relation feature is done.
Check :py:class:`QgsRealationEditorWidget` as an example.
%End
virtual void afterSetRelationFeature();
%Docstring
A hook called right after :py:func:`~QgsAbstractRelationEditorWidget.setRelationFeature` is executed, but before :py:func:`~QgsAbstractRelationEditorWidget.updateUi` is called. Used to update the UI once setting the relation feature is done.
Check :py:class:`QgsRealationEditorWidget` as an example.
%End
virtual void beforeSetRelations( const QgsRelation &newRelation, const QgsRelation &newNmRelation );
%Docstring
A hook called right before :py:func:`~QgsAbstractRelationEditorWidget.setRelations` is executed. Used to manipulate UI once setting the relations is done.
Check :py:class:`QgsRealationEditorWidget` as an example.
%End
virtual void afterSetRelations();
%Docstring
A hook called right after :py:func:`~QgsAbstractRelationEditorWidget.setRelations` is executed, but before :py:func:`~QgsAbstractRelationEditorWidget.updateUi` is called. Used to update the UI once setting the relations is done.
Check :py:class:`QgsRealationEditorWidget` as an example.
%End
};
class QgsAbstractRelationEditorConfigWidget : QWidget
{
%Docstring(signature="appended")
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:`QgsAbstractRelationEditorWidgetFactory`}
.. versionadded:: 3.18
%End
%TypeHeaderCode
#include "qgsabstractrelationeditorwidget.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsRelationEditorConfigWidget *>( sipCpp ) )
sipType = sipType_QgsRelationEditorConfigWidget;
else
sipType = 0;
%End
public:
explicit QgsAbstractRelationEditorConfigWidget( 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
virtual void setNmRelation( const QgsRelation &nmRelation );
%Docstring
Set the nm relation for this widget.
:param nmRelation: The nm relation
%End
virtual QgsRelation nmRelation() const;
%Docstring
Returns the nm relation for which this configuration widget applies
:return: The nm relation
%End
};
class QgsAbstractRelationEditorWidgetFactory
{
%Docstring(signature="appended")
Factory class for creating relation widgets and their corresponding config widgets
.. versionadded:: 3.18
%End
%TypeHeaderCode
#include "qgsabstractrelationeditorwidget.h"
%End
public:
QgsAbstractRelationEditorWidgetFactory();
%Docstring
Creates a new relation widget factory with given ``name``
%End
virtual ~QgsAbstractRelationEditorWidgetFactory();
virtual QString type() const = 0;
%Docstring
Returns the machine readable identifier name of this widget type
%End
virtual QString name() const = 0;
%Docstring
Returns the human readable identifier name of this widget type
%End
virtual QgsAbstractRelationEditorWidget *create( const QVariantMap &config, QWidget *parent = 0 ) const = 0 /Factory/;
%Docstring
Override this in your implementation.
Create a new relation widget. Call :py:func:`QgsEditorWidgetRegistry.create()`
instead of calling this method directly.
:param config: The widget configuration to build the widget with
:param parent: The parent for the wrapper class and any created widget.
:return: A new widget wrapper
%End
virtual QgsAbstractRelationEditorConfigWidget *configWidget( const QgsRelation &relation, QWidget *parent ) const = 0 /Factory/;
%Docstring
Override this in your implementation.
Create a new configuration widget for this widget type.
:param relation: The relation for which the widget will be created
:param parent: The parent widget of the created config widget
:return: A configuration widget
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsabstractrelationeditorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
|