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;
212 Q_DECL_DEPRECATED
void attributeChanged(
const QString &attribute,
const QVariant &value )
SIP_DEPRECATED;
222 void widgetValueChanged(
const QString &attribute,
const QVariant &value,
bool attributeChanged );
232 void beforeSave(
bool &ok )
SIP_SKIP;
237 void featureSaved(
const QgsFeature &feature );
263 void zoomToFeatures(
const QString &filter );
269 void flashFeatures(
const QString &filter );
275 void openFilteredFeaturesAttributeTable(
const QString &filter );
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;
569 #endif // QGSATTRIBUTEFORM_H