QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsattributesformproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributesformproperties.h
3 ---------------------
4 begin : August 2017
5 copyright : (C) 2017 by David Signer
6 email : david at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSATTRIBUTESFORMPROPERTIES_H
17#define QGSATTRIBUTESFORMPROPERTIES_H
18
19// We don't want to expose this in the public API
20#define SIP_NO_FILE
21
22#include "ui_qgsattributesformproperties.h"
23
24#include "qgis_gui.h"
25#include "qgsaction.h"
28#include "qgsmessagebar.h"
30#include "qgssettingstree.h"
31#include "qgssettingstreenode.h"
32
33#include <QAction>
34#include <QClipboard>
35#include <QDropEvent>
36#include <QFileDialog>
37#include <QFormLayout>
38#include <QHBoxLayout>
39#include <QMenu>
40#include <QMessageBox>
41#include <QMimeData>
42#include <QPlainTextEdit>
43#include <QPushButton>
44#include <QSpinBox>
45#include <QTreeView>
46#include <QWidget>
47
48class QgsAttributeFormContainerEdit;
49class QgsAttributeTypeDialog;
50class QgsAttributeWidgetEdit;
54
62class GUI_EXPORT QgsAttributesFormProperties : public QWidget, public QgsExpressionContextGenerator, private Ui_QgsAttributesFormProperties
63{
64 Q_OBJECT
65
66 public:
67 static inline QgsSettingsTreeNode *sTreeAttributesForm = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "attributes-form" ) );
69
70 explicit QgsAttributesFormProperties( QgsVectorLayer *layer, QWidget *parent = nullptr );
71
72 void init();
73
77 void apply();
78
83 void store();
84
86
91
95 void initFormLayoutView();
96
97 void initLayoutConfig();
98 void initInitPython();
99 void initSuppressCombo();
100
106 void initAvailableWidgetsActions( const QList< QgsAction > actions );
107
109
110 protected:
112
114
117
118 QgsAttributeWidgetEdit *mAttributeWidgetEdit = nullptr;
119 QgsAttributeTypeDialog *mAttributeTypeDialog = nullptr;
120 QgsAttributeFormContainerEdit *mAttributeContainerEdit = nullptr;
121 QLabel *mInfoTextWidget = nullptr;
122
123 private slots:
124 void addContainer();
125 void removeTabOrGroupButton();
126 void mEditorLayoutComboBox_currentIndexChanged( int index );
127 void pbnSelectEditForm_clicked();
128 void mTbInitCode_clicked();
129 void toggleShowAliases( bool checked );
130
134 void onInvertSelectionButtonClicked( bool checked );
135
136 void loadAttributeSpecificEditor( QgsAttributesFormBaseView *emitter, QgsAttributesFormBaseView *receiver, QModelIndex &deselectedFormLayoutIndex );
137 void onAttributeSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
138 void onFormLayoutSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
139
141 void onContextMenuRequested( QPoint );
142
143 void updatedFields();
144
145 void updateFilteredItems( const QString &filterText );
146
147 private:
149 void clearAttributeTypeFrame();
150
151 void loadAttributeWidgetEdit();
152
156 void storeAttributeWidgetEdit();
157
161 void storeAttributeContainerEdit();
162
164 void storeAttributeWidgetEdit( const QModelIndex &index );
165 void storeAttributeContainerEdit( const QModelIndex &index );
166
167 void loadAttributeTypeDialog();
168 void loadAttributeTypeDialogFromConfiguration( const QgsAttributesFormData::FieldConfig &cfg );
169 void storeAttributeTypeDialog();
170
171 void loadAttributeContainerEdit();
172
173 void loadInfoWidget( const QString &infoText );
174
175 void copyWidgetConfiguration();
176 void pasteWidgetConfiguration();
177
178 void setAvailableWidgetsIndicatorProvidersEnabled( bool enabled );
179 void setFormLayoutIndicatorProvidersEnabled( bool enabled );
180
181 QgsAttributesAvailableWidgetsModel *mAvailableWidgetsModel = nullptr;
182 QgsAttributesFormLayoutModel *mFormLayoutModel = nullptr;
183 QgsAttributesFormProxyModel *mAvailableWidgetsProxyModel = nullptr;
184 QgsAttributesFormProxyModel *mFormLayoutProxyModel = nullptr;
185
186 QgsMessageBar *mMessageBar = nullptr;
187
189 QString mInitFunction;
190 QString mInitFilePath;
191 QString mInitCode;
192 int mBlockUpdates = 0;
193
195 QMenu *mAvailableWidgetsContextMenu = nullptr;
196 QAction *mActionCopyWidgetConfiguration = nullptr;
197 QAction *mActionPasteWidgetConfiguration = nullptr;
198
200 QgsFieldConstraintIndicatorProvider *mConstraintIndicatorProviderAvailableWidgets = nullptr;
201 QgsFieldDefaultValueIndicatorProvider *mDefaultValueIndicatorProviderAvailableWidgets = nullptr;
202 QgsFieldConstraintIndicatorProvider *mConstraintIndicatorProviderFormLayout = nullptr;
203 QgsFieldDefaultValueIndicatorProvider *mDefaultValueIndicatorProviderFormLayout = nullptr;
204
206};
207
208#endif // QGSATTRIBUTESFORMPROPERTIES_H
AttributeFormPythonInitCodeSource
The Python init code source for attribute forms.
Definition qgis.h:5515
@ NoSource
Do not use Python code at all.
Definition qgis.h:5516
Manages available widgets when configuring attributes forms.
Graphical representation for the attribute drag and drop editor.
Manages form layouts when configuring attributes forms via drag and drop designer.
QgsAttributesFormBaseView * mFormLayoutView
void initAvailableWidgetsActions(const QList< QgsAction > actions)
Refresh layer actions in the Available Widgets view.
QgsAttributeFormContainerEdit * mAttributeContainerEdit
static const QgsSettingsEntryBool * settingShowAliases
QgsAttributesFormProperties(QgsVectorLayer *layer, QWidget *parent=nullptr)
static QgsSettingsTreeNode * sTreeAttributesForm
QgsAttributesFormBaseView * mAvailableWidgetsView
QgsAttributeTypeDialog * mAttributeTypeDialog
void store()
Stores currently opened widget configuration.
QgsAttributeWidgetEdit * mAttributeWidgetEdit
void apply()
Applies the attribute from properties to the vector layer.
void initFormLayoutView()
Initializes the form layout tree view, repopulating the underlying model.
void initAvailableWidgetsView()
Initializes the available widgets tree view, repopulating the underlying model.
Proxy model to filter items in the tree views of the drag and drop designer.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Provides field constraint indicators for attribute form views.
Provides default value indicators for attribute form views.
A bar for displaying non-blocking messages to the user.
A boolean settings entry.
A tree node for the settings tree to help organizing and introspecting the tree.
static QgsSettingsTreeNode * sTreeApp
Represents a vector layer which manages a vector based dataset.
Holds the configuration for a field.