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