QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsfieldcalculator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfieldcalculator.h
3 ---------------------
4 begin : September 2009
5 copyright : (C) 2009 by Marco Hugentobler
6 email : marco at hugis dot net
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 QGSFIELDCALCULATOR_H
17#define QGSFIELDCALCULATOR_H
18
19#include "ui_qgsfieldcalculatorbase.h"
20#include "qgshelp.h"
21#include "qgsfields.h"
22#include "qgis_gui.h"
23
24class QgsVectorLayer;
25
42class GUI_EXPORT QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalculatorBase
43{
44 Q_OBJECT
45 public:
46 QgsFieldCalculator( QgsVectorLayer *vl, QWidget *parent = nullptr );
47
53 int changedAttributeId() const { return mAttributeId; }
54
55 public slots:
56 void accept() override;
57
58 private slots:
59 void mNewFieldGroupBox_toggled( bool on );
60 void mUpdateExistingGroupBox_toggled( bool on );
61 void mCreateVirtualFieldCheckbox_stateChanged( int state );
62 void mOutputFieldNameLineEdit_textChanged( const QString &text );
63 void mOutputFieldTypeComboBox_activated( int index );
64
66 void setOkButtonState();
67 void setPrecisionMinMax();
68 void showHelp();
69
70 private:
74 void populateFields();
76 void populateOutputFieldTypes();
77
78 QgsVectorLayer *mVectorLayer = nullptr;
79
80 bool mCanAddAttribute = false;
81 bool mCanChangeAttributeValue = false;
82
84 QgsField fieldDefinition();
85
87 int mAttributeId;
88
89 friend class TestQgsFieldCalculator;
90};
91
92#endif // QGSFIELDCALCULATOR_H
A dialog class that provides calculation of new fields using existing fields, values and a set of ope...
int changedAttributeId() const
Returns the field index of the field for which new attribute values were calculated.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:51
Represents a vector layer which manages a vector based data sets.