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;
414 void createWrappers();
415 void afterWidgetInit();
417 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
420 bool saveEdits( QString *error );
425 void updateValuesDependencies(
const int originIdx );
426 void updateValuesDependenciesDefaultValues(
const int originIdx );
427 void updateValuesDependenciesVirtualFields(
const int originIdx );
428 void updateRelatedLayerFields();
430 void clearMultiEditMessages();
431 void pushSelectedFeaturesMessage();
434 QString createFilterExpression()
const;
439 void updateAllConstraints();
441 void updateContainersVisibility();
444 bool currentFormValuesFeature(
QgsFeature &feature );
445 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
446 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
456 bool mOwnsMessageBar;
459 QList<QgsWidgetWrapper *> mWidgets;
461 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
462 QDialogButtonBox *mButtonBox =
nullptr;
463 QWidget *mSearchButtonBox =
nullptr;
464 QList<QgsAttributeFormInterface *> mInterfaces;
465 QMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
466 QList< QgsAttributeFormWidget *> mFormWidgets;
467 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
468 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
469 bool mValuesInitialized =
false;
471 bool mIsSettingFeature =
false;
473 bool mValidConstraints =
true;
476 struct ContainerInformation
479 : tabWidget( tabWidget )
481 , expression( expression )
485 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
487 , expression( expression )
492 QWidget *widget =
nullptr;
499 void registerContainerInformation( ContainerInformation *info );
503 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
506 QVector<ContainerInformation *> mContainerVisibilityInformation;
507 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
510 static int sFormCounter;
512 QString mPyFormVarName;
518 bool mPreventFeatureRefresh;
520 bool mIsSettingMultiEditFeatures;
523 bool mUnsavedMultiEditChanges;
525 QString mEditCommandMessage;
529 QMap<QWidget *, QSvgWidget *> mIconMap;
535 QMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
541 QMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
546 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
549 QList<int> mAlreadyUpdatedFields;
551 bool mNeedsGeometry =
false;
553 friend class TestQgsDualView;
554 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