QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
qgsattributesformview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributesformview.h
3 ---------------------
4 begin : June 2025
5 copyright : (C) 2025 by Germán Carrillo
6 email : german 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 QGSATTRIBUTESFORMVIEW_H
17#define QGSATTRIBUTESFORMVIEW_H
18
19// We don't want to expose this in the public API
20
21#include "qgis_gui.h"
23
24#include <QTreeView>
25
26#define SIP_NO_FILE
27
29
37class GUI_EXPORT QgsAttributesFormBaseView : public QTreeView, public QgsExpressionContextGenerator
38{
39 Q_OBJECT
40
41 public:
47 explicit QgsAttributesFormBaseView( QgsVectorLayer *layer, QWidget *parent = nullptr );
48
54 QModelIndex firstSelectedIndex() const;
55
56 // QgsExpressionContextGenerator interface
58
64 const QList<QgsAttributesFormTreeViewIndicator *> indicators( const QModelIndex &index ) const;
65
71 const QList<QgsAttributesFormTreeViewIndicator *> indicators( QgsAttributesFormItem *item ) const;
72
79
86
93
100
101 public slots:
102
108 void selectFirstMatchingItem( const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId );
109
115 void setFilterText( const QString &text );
116
117 protected:
120
122 QHash< QgsAttributesFormItem *, QList< QgsAttributesFormTreeViewIndicator * > > mIndicators;
123};
124
125
134{
135 Q_OBJECT
136
137 public:
143 explicit QgsAttributesAvailableWidgetsView( QgsVectorLayer *layer, QWidget *parent = nullptr );
144
146 void setModel( QAbstractItemModel *model ) override;
147
150};
151
152
161{
162 Q_OBJECT
163
164 public:
170 explicit QgsAttributesFormLayoutView( QgsVectorLayer *layer, QWidget *parent = nullptr );
171
173 void setModel( QAbstractItemModel *model ) override;
174
175 protected:
176 // Drag and drop support (to handle internal moves)
177 void dragEnterEvent( QDragEnterEvent *event ) override;
178 void dragMoveEvent( QDragMoveEvent *event ) override;
179 void dropEvent( QDropEvent *event ) override;
180
181 private slots:
182 void onItemDoubleClicked( const QModelIndex &index );
183 void handleExternalDroppedItem( QModelIndex &index );
184 void handleInternalDroppedItem( QModelIndex &index );
185};
186
187
188#endif // QGSATTRIBUTESFORMVIEW_H
Manages available widgets when configuring attributes forms.
void setModel(QAbstractItemModel *model) override
Overridden setModel() from base class. Only QgsAttributesFormProxyModel is an acceptable model.
QgsAttributesAvailableWidgetsView(QgsVectorLayer *layer, QWidget *parent=nullptr)
Constructor for QgsAttributesAvailableWidgetsView, with the given parent.
QgsAttributesAvailableWidgetsModel * availableWidgetsModel() const
Access the underlying QgsAttributesAvailableWidgetsModel source model.
void setFilterText(const QString &text)
Sets the filter text to the underlying proxy model.
QgsAttributesFormProxyModel * mModel
QgsAttributesFormModel * sourceModel() const
Returns the underlying QgsAttributesFormModel model where the view gets data from.
void addIndicator(QgsAttributesFormItem *item, QgsAttributesFormTreeViewIndicator *indicator)
Adds the indicator to the given item.
QHash< QgsAttributesFormItem *, QList< QgsAttributesFormTreeViewIndicator * > > mIndicators
Storage of indicators used with the tree view.
void removeIndicator(QgsAttributesFormItem *item, QgsAttributesFormTreeViewIndicator *indicator)
Removes the indicator from the given item.
void removeAllIndicators()
Removes all indicators in the current view.
QgsAttributesFormBaseView(QgsVectorLayer *layer, QWidget *parent=nullptr)
Constructor for QgsAttributesFormBaseView, with the given parent.
const QList< QgsAttributesFormTreeViewIndicator * > indicators(const QModelIndex &index) const
Returns the list of indicators associated with a given index.
void selectFirstMatchingItem(const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId)
Selects the first item that matches a itemType and a itemId.
QModelIndex firstSelectedIndex() const
Returns the source model index corresponding to the first selected row.
AttributesFormItemType
Custom item types.
Holds parent-child relations as well as item data contained in a QgsAttributesFormModel.
void dropEvent(QDropEvent *event) override
void dragEnterEvent(QDragEnterEvent *event) override
QgsAttributesFormLayoutView(QgsVectorLayer *layer, QWidget *parent=nullptr)
Constructor for QgsAttributesFormLayoutView, with the given parent.
void setModel(QAbstractItemModel *model) override
Overridden setModel() from base class. Only QgsAttributesFormProxyModel is an acceptable model.
void dragMoveEvent(QDragMoveEvent *event) override
Is called when mouse is moved over attributes tree before a drop event.
Abstract class for tree models allowing for configuration of attributes forms.
Proxy model to filter items in the tree views of the drag and drop designer.
Indicator that can be used in an Attributes Form tree view to display icons next to field items.
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...
Represents a vector layer which manages a vector based dataset.