QGIS API Documentation 3.43.0-Master (b60ef06885e)
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
49class GUI_EXPORT QgsSourceFieldsProperties : public QWidget, private Ui_QgsSourceFieldsProperties
50{
51 Q_OBJECT
52
53 public:
54 explicit QgsSourceFieldsProperties( QgsVectorLayer *layer, QWidget *parent = nullptr );
55
56 void init();
57 void apply();
58
59 void loadRows();
60 void setRow( int row, int idx, const QgsField &field );
61
67 bool addAttribute( const QgsField &field );
68
69 protected:
70 void updateButtons();
71
72 QgsVectorLayer *mLayer = nullptr;
73
74 // Holds all the first column items (header: id) of the table.
75 // The index in the list is the fieldIdx, and therefore acts as a mapping
76 // between fieldIdx and QTableWidgetItem->row()
77 QList<QTableWidgetItem *> mIndexedWidgets;
78
92
93 private:
94 void updateFieldRenamingStatus();
95
96 signals:
98
99 private slots:
100
101 void updateExpression();
102
104 void editingToggled();
105 void addAttributeClicked();
106 void deleteAttributeClicked();
107 void calculateFieldClicked();
108 void saveLayerEditsClicked();
109
110 void attributeAdded( int idx );
111 void attributeDeleted( int idx );
112
113 void attributesListCellChanged( int row, int column );
114 void attributesListCellPressed( int row, int column );
115};
116
117#endif // QGSSOURCEFIELDSPROPERTIES_H
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:53
A widget which displays information about vector layer fields, and allows some configuration of them.
QList< QTableWidgetItem * > mIndexedWidgets
Represents a vector layer which manages a vector based dataset.