QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
Loading...
Searching...
No Matches
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
22#include "ui_qgssourcefieldsproperties.h"
23
24#include "qgis_gui.h"
26#include "qgsfieldcalculator.h"
27#include "qgslogger.h"
28
29#include <QDropEvent>
30#include <QFileDialog>
31#include <QFormLayout>
32#include <QHBoxLayout>
33#include <QMessageBox>
34#include <QMimeData>
35#include <QPushButton>
36#include <QSpinBox>
37#include <QTableWidget>
38#include <QTableWidgetItem>
39#include <QTreeWidget>
40#include <QTreeWidgetItem>
41#include <QWidget>
42
43#define SIP_NO_FILE
44
51class GUI_EXPORT QgsSourceFieldsProperties : public QWidget, private Ui_QgsSourceFieldsProperties
52{
53 Q_OBJECT
54
55 public:
56 explicit QgsSourceFieldsProperties( QgsVectorLayer *layer, QWidget *parent = nullptr );
57
58 void init();
59 void apply();
60
61 void loadRows();
62 void setRow( int row, int idx, const QgsField &field );
63
69 bool addAttribute( const QgsField &field );
70
71 protected:
72 void updateButtons();
73
75
76 // Holds all the first column items (header: id) of the table.
77 // The index in the list is the fieldIdx, and therefore acts as a mapping
78 // between fieldIdx and QTableWidgetItem->row()
79 QList<QTableWidgetItem *> mIndexedWidgets;
80
94
95 private:
96 void updateFieldRenamingStatus();
97
98 signals:
100
101 private slots:
102
103 void updateExpression();
104
106 void editingToggled();
107 void addAttributeClicked();
108 void deleteAttributeClicked();
109 void calculateFieldClicked();
110 void saveLayerEditsClicked();
111
112 void attributeAdded( int idx );
113 void attributeDeleted( int idx );
114
115 void attributesListCellChanged( int row, int column );
116 void attributesListCellPressed( int row, int column );
117
118 void applyToLayer( QgsVectorLayer *layer );
119
121};
122
123#endif // QGSSOURCEFIELDSPROPERTIES_H
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:56
QList< QTableWidgetItem * > mIndexedWidgets
QgsSourceFieldsProperties(QgsVectorLayer *layer, QWidget *parent=nullptr)
bool addAttribute(const QgsField &field)
Adds an attribute to the table (but does not commit it yet).
void setRow(int row, int idx, const QgsField &field)
Represents a vector layer which manages a vector based dataset.