QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgssourcefieldsproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssourcefieldsproperties.h
3 ---------------------
4 begin : July 2017
5 copyright : (C) 2017 by David Signer
6 email : david at opengis dot ch
7
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSSOURCEFIELDSPROPERTIES_H
18#define QGSSOURCEFIELDSPROPERTIES_H
19
20// We don't want to expose this in the public API
21#define SIP_NO_FILE
22
23#include <QMimeData>
24#include <QPushButton>
25#include <QTableWidget>
26#include <QTreeWidget>
27#include <QWidget>
28#include <QSpinBox>
29#include <QTreeWidgetItem>
30#include <QDropEvent>
31#include <QTableWidgetItem>
32#include <QMessageBox>
33#include <QFileDialog>
34#include <QHBoxLayout>
35#include <QFormLayout>
36
37#include "ui_qgssourcefieldsproperties.h"
38#include "qgis_gui.h"
39#include "qgslogger.h"
41#include "qgsfieldcalculator.h"
42
47class GUI_EXPORT QgsSourceFieldsProperties : public QWidget, private Ui_QgsSourceFieldsProperties
48{
49 Q_OBJECT
50
51 public:
52 explicit QgsSourceFieldsProperties( QgsVectorLayer *layer, QWidget *parent = nullptr );
53
54 void init();
55 void apply();
56
57 void loadRows();
58 void setRow( int row, int idx, const QgsField &field );
59
65 bool addAttribute( const QgsField &field );
66
67 protected:
68 void updateButtons();
69
70 QgsVectorLayer *mLayer = nullptr;
71
72 // Holds all the first column items (header: id) of the table.
73 // The index in the list is the fieldIdx, and therefore acts as a mapping
74 // between fieldIdx and QTableWidgetItem->row()
75 QList<QTableWidgetItem *> mIndexedWidgets;
76
78 {
79 AttrIdCol = 0,
89 };
90
91 private:
92 Ui::QgsSourceFieldsProperties *ui = nullptr;
93 void updateFieldRenamingStatus();
94
95 signals:
97
98 private slots:
99
100 void updateExpression();
101
103 void editingToggled();
104 void addAttributeClicked();
105 void deleteAttributeClicked();
106 void calculateFieldClicked();
107
108 void attributeAdded( int idx );
109 void attributeDeleted( int idx );
110
111 void attributesListCellChanged( int row, int column );
112 void attributesListCellPressed( int row, int column );
113
114};
115
116#endif // QGSSOURCEFIELDSPROPERTIES_H
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:51
QList< QTableWidgetItem * > mIndexedWidgets
Represents a vector layer which manages a vector based data sets.
const QgsField & field
Definition: qgsfield.h:463