16#ifndef QGSATTRIBUTEFORM_H
17#define QGSATTRIBUTEFORM_H
26#include <QDialogButtonBox>
94 void displayWarning(
const QString &message );
102 void hideButtonBox();
110 void showButtonBox();
118 void disconnectButtonBox();
170 bool eventFilter( QObject *
object, QEvent *event )
override;
194 QString aggregateFilter()
const;
289 void changeAttribute(
const QString &
field,
const QVariant &value,
const QString &hintText = QString() );
314 bool saveWithDetails( QString *error
SIP_OUT =
nullptr );
330 void refreshFeature();
341 void parentFormValueChanged(
const QString &attribute,
const QVariant &newValue );
347 bool needsGeometry()
const;
350 void onAttributeChanged(
const QVariant &value,
const QVariantList &additionalFieldValues );
351 void onAttributeAdded(
int idx );
352 void onAttributeDeleted(
int idx );
353 void onRelatedFeaturesChanged();
354 void onUpdatedFields();
355 void onConstraintStatusChanged(
const QString &constraint,
357 void preventFeatureRefresh();
358 void synchronizeState();
359 void layerSelectionChanged();
362 bool saveMultiEdits();
363 void resetMultiEdit(
bool promptToSave =
false );
364 void multiEditMessageClicked(
const QString &link );
366 void filterAndTriggered();
367 void filterOrTriggered();
368 void filterTriggered();
372 void searchSetSelection();
373 void searchAddToSelection();
374 void searchRemoveFromSelection();
375 void searchIntersectSelection();
386 bool fieldIsEditable(
int fieldIndex )
const;
390 void updateFieldDependencies();
395 void setMultiEditFeatureIdsRelations(
const QgsFeatureIds &fids );
399 QWidget *widget =
nullptr;
403 bool labelOnTop =
false;
404 bool labelAlignRight =
false;
405 bool showLabel =
true;
417 void createWrappers();
418 void afterWidgetInit();
420 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
423 bool saveEdits( QString *error );
428 void updateValuesDependencies(
const int originIdx );
429 void updateValuesDependenciesDefaultValues(
const int originIdx );
430 void updateValuesDependenciesVirtualFields(
const int originIdx );
431 void updateRelatedLayerFields();
433 void clearMultiEditMessages();
434 void pushSelectedFeaturesMessage();
437 QString createFilterExpression()
const;
442 void updateAllConstraints();
444 void updateContainersVisibility();
447 bool currentFormValuesFeature(
QgsFeature &feature );
448 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
449 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
459 bool mOwnsMessageBar;
462 QList<QgsWidgetWrapper *> mWidgets;
464 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
465 QDialogButtonBox *mButtonBox =
nullptr;
466 QWidget *mSearchButtonBox =
nullptr;
467 QList<QgsAttributeFormInterface *> mInterfaces;
468 QMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
469 QList< QgsAttributeFormWidget *> mFormWidgets;
470 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
471 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
472 bool mValuesInitialized =
false;
474 bool mIsSettingFeature =
false;
476 bool mValidConstraints =
true;
479 struct ContainerInformation
482 : tabWidget( tabWidget )
484 , expression( expression )
488 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
490 , expression( expression )
494 ContainerInformation( QWidget *widget,
const QgsExpression &visibilityExpression,
bool collapsed,
const QgsExpression &collapsedExpression )
496 , expression( visibilityExpression )
498 , isCollapsed( collapsed )
499 , collapsedExpression( collapsedExpression )
504 QWidget *widget =
nullptr;
507 bool isCollapsed =
false;
513 void registerContainerInformation( ContainerInformation *info );
517 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
520 QVector<ContainerInformation *> mContainerVisibilityCollapsedInformation;
521 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
524 static int sFormCounter;
526 QString mPyFormVarName;
532 bool mPreventFeatureRefresh;
534 bool mIsSettingMultiEditFeatures;
537 bool mUnsavedMultiEditChanges;
539 QString mEditCommandMessage;
543 QMap<QWidget *, QSvgWidget *> mIconMap;
549 QMultiMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
555 QMultiMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
560 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
563 QList<int> mAlreadyUpdatedFields;
565 bool mNeedsGeometry =
false;
567 friend class TestQgsDualView;
568 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.