16 #ifndef QGSATTRIBUTEFORM_H
17 #define QGSATTRIBUTEFORM_H
26 #include <QDialogButtonBox>
92 void displayWarning(
const QString &message );
100 void hideButtonBox();
108 void showButtonBox();
116 void disconnectButtonBox();
168 bool eventFilter( QObject *
object, QEvent *event )
override;
192 QString aggregateFilter()
const;
287 void changeAttribute(
const QString &
field,
const QVariant &value,
const QString &hintText = QString() );
312 bool saveWithDetails( QString *error
SIP_OUT =
nullptr );
328 void refreshFeature();
339 void parentFormValueChanged(
const QString &attribute,
const QVariant &newValue );
345 bool needsGeometry()
const;
348 void onAttributeChanged(
const QVariant &value,
const QVariantList &additionalFieldValues );
349 void onAttributeAdded(
int idx );
350 void onAttributeDeleted(
int idx );
351 void onRelatedFeaturesChanged();
352 void onUpdatedFields();
353 void onConstraintStatusChanged(
const QString &constraint,
355 void preventFeatureRefresh();
356 void synchronizeState();
357 void layerSelectionChanged();
360 bool saveMultiEdits();
361 void resetMultiEdit(
bool promptToSave =
false );
362 void multiEditMessageClicked(
const QString &link );
364 void filterAndTriggered();
365 void filterOrTriggered();
366 void filterTriggered();
370 void searchSetSelection();
371 void searchAddToSelection();
372 void searchRemoveFromSelection();
373 void searchIntersectSelection();
384 bool fieldIsEditable(
int fieldIndex )
const;
388 void updateFieldDependencies();
393 void setMultiEditFeatureIdsRelations(
const QgsFeatureIds &fids );
397 QWidget *widget =
nullptr;
401 bool labelOnTop =
false;
402 bool labelAlignRight =
false;
403 bool showLabel =
true;
415 void createWrappers();
416 void afterWidgetInit();
418 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
421 bool saveEdits( QString *error );
426 void updateValuesDependencies(
const int originIdx );
427 void updateValuesDependenciesDefaultValues(
const int originIdx );
428 void updateValuesDependenciesVirtualFields(
const int originIdx );
429 void updateRelatedLayerFields();
431 void clearMultiEditMessages();
432 void pushSelectedFeaturesMessage();
435 QString createFilterExpression()
const;
440 void updateAllConstraints();
442 void updateContainersVisibility();
445 bool currentFormValuesFeature(
QgsFeature &feature );
446 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
447 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
457 bool mOwnsMessageBar;
460 QList<QgsWidgetWrapper *> mWidgets;
462 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
463 QDialogButtonBox *mButtonBox =
nullptr;
464 QWidget *mSearchButtonBox =
nullptr;
465 QList<QgsAttributeFormInterface *> mInterfaces;
466 QMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
467 QList< QgsAttributeFormWidget *> mFormWidgets;
468 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
469 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
470 bool mValuesInitialized =
false;
472 bool mIsSettingFeature =
false;
474 bool mValidConstraints =
true;
477 struct ContainerInformation
480 : tabWidget( tabWidget )
482 , expression( expression )
486 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
488 , expression( expression )
492 ContainerInformation( QWidget *widget,
const QgsExpression &visibilityExpression,
bool collapsed,
const QgsExpression &collapsedExpression )
494 , expression( visibilityExpression )
496 , isCollapsed( collapsed )
497 , collapsedExpression( collapsedExpression )
502 QWidget *widget =
nullptr;
505 bool isCollapsed =
false;
511 void registerContainerInformation( ContainerInformation *info );
515 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
518 QVector<ContainerInformation *> mContainerVisibilityCollapsedInformation;
519 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
522 static int sFormCounter;
524 QString mPyFormVarName;
530 bool mPreventFeatureRefresh;
532 bool mIsSettingMultiEditFeatures;
535 bool mUnsavedMultiEditChanges;
537 QString mEditCommandMessage;
541 QMap<QWidget *, QSvgWidget *> mIconMap;
547 QMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
553 QMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
558 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
561 QList<int> mAlreadyUpdatedFields;
563 bool mNeedsGeometry =
false;
565 friend class TestQgsDualView;
566 friend class TestQgsAttributeForm;
SelectBehavior
Specifies how a selection should be applied.
This class contains context information for attribute editor widgets.
This is an abstract base class for any elements of a drag and drop form.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Represents an item shown within a QgsMessageBar widget.
A bar for displaying non-blocking messages to the user.
Represents a vector layer which manages a vector based data sets.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.