16 #ifndef QGSRELATIONEDITORWIDGET_H
17 #define QGSRELATIONEDITORWIDGET_H
20 #include <QToolButton>
21 #include <QButtonGroup>
22 #include <QGridLayout>
25 #include "ui_qgsrelationeditorconfigwidgetbase.h"
36 class QTreeWidgetItem;
94 Q_PROPERTY( Buttons visibleButtons READ visibleButtons WRITE setVisibleButtons )
107 SaveChildEdits = 1 << 3,
108 AddChildFeature = 1 << 4,
109 DuplicateChildFeature = 1 << 5,
110 DeleteChildFeature = 1 << 6,
111 ZoomToChildFeature = 1 << 7,
112 AllButtons = Link | Unlink | SaveChildEdits | AddChildFeature | DuplicateChildFeature | DeleteChildFeature | ZoomToChildFeature
115 Q_DECLARE_FLAGS( Buttons, Button )
147 void setVisibleButtons(
const Buttons &buttons );
152 Buttons visibleButtons()
const;
164 void duplicateSelectedFeatures();
169 void unlinkSelectedFeatures();
174 void deleteSelectedFeatures();
179 void zoomToSelectedFeatures();
184 QVariantMap config() const override;
189 void setConfig( const QVariantMap &config ) override;
192 void parentFormValueChanged( const QString &attribute, const QVariant &newValue ) override;
195 virtual
void updateUi() override;
196 void beforeSetRelationFeature( const
QgsRelation &newRelation, const
QgsFeature &newFeature ) override;
197 void afterSetRelationFeature() override;
199 void afterSetRelations() override;
203 void updateButtons();
206 void addFeatureGeometry();
209 void mapToolDeactivated();
210 void onKeyPressed( QKeyEvent *e );
211 void onDigitizingCompleted(
const QgsFeature &feature );
213 void multiEditItemSelectionChanged();
217 enum class MultiEditFeatureType : int
223 enum class MultiEditTreeWidgetRole : int
225 FeatureType = Qt::UserRole + 1,
226 FeatureId = Qt::UserRole + 2
233 void updateUiSingleEdit();
234 void updateUiMultiEdit();
235 QTreeWidgetItem *createMultiEditTreeWidgetItem(
const QgsFeature &feature,
QgsVectorLayer *layer, MultiEditFeatureType type );
238 QPointer<QgsMessageBarItem> mMessageBarItem;
241 QToolButton *mToggleEditingButton =
nullptr;
242 QToolButton *mSaveEditsButton =
nullptr;
243 QToolButton *mAddFeatureButton =
nullptr;
244 QToolButton *mDuplicateFeatureButton =
nullptr;
245 QToolButton *mDeleteFeatureButton =
nullptr;
246 QToolButton *mLinkFeatureButton =
nullptr;
247 QToolButton *mUnlinkFeatureButton =
nullptr;
248 QToolButton *mZoomToFeatureButton =
nullptr;
249 QToolButton *mFormViewButton =
nullptr;
250 QToolButton *mTableViewButton =
nullptr;
251 QToolButton *mAddFeatureGeometryButton =
nullptr;
252 QLabel *mMultiEditInfoLabel =
nullptr;
253 QStackedWidget *mStackedWidget =
nullptr;
254 QWidget *mMultiEditStackedWidgetPage =
nullptr;
255 QTreeWidget *mMultiEditTreeWidget =
nullptr;
257 QButtonGroup *mViewModeButtonGroup =
nullptr;
260 Buttons mButtonsVisibility = Button::AllButtons;
261 bool mShowFirstFeature =
true;
263 QList<QTreeWidgetItem *> mMultiEditPreviousSelectedItems;
266 friend class TestQgsRelationEditorWidget;
302 void setConfig(
const QVariantMap &config );
321 QString type()
const override;
323 QString name()
const override;
This class contains context information for attribute editor widgets.
This widget is used to show the attributes of a set of features of a QgsVectorLayer.
ViewMode
The view modes, in which this widget can present information.
@ AttributeEditor
Show a list of the features, where one can be chosen and the according attribute dialog will be prese...
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Is an interface class to abstract feature selection handling.
int selectedFeatureCount() override
Returns the number of features that are selected in this layer.
const QgsFeatureIds & selectedFeatureIds() const override
Returns reference to identifiers of selected features.
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