QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
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;
25class QgsMessageBar;
26
43class GUI_EXPORT QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalculatorBase
44{
45 Q_OBJECT
46 public:
47 QgsFieldCalculator( QgsVectorLayer *vl, QWidget *parent = nullptr );
48
54 int changedAttributeId() const { return mAttributeId; }
55
56 public slots:
57 void accept() override;
58
59 private slots:
60 void mNewFieldGroupBox_toggled( bool on );
61 void mUpdateExistingGroupBox_toggled( bool on );
62 void mCreateVirtualFieldCheckbox_stateChanged( int state );
63 void mOutputFieldNameLineEdit_textChanged( const QString &text );
64 void mOutputFieldTypeComboBox_activated( int index );
65
67 void setDialogButtonState();
68 void setPrecisionMinMax();
69 void showHelp();
70 void calculate();
72 void pushMessage( const QString &text, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = -1 );
73
74 private:
78 void populateFields();
80 void populateOutputFieldTypes();
81
82 QgsVectorLayer *mVectorLayer = nullptr;
83
84 bool mCanAddAttribute = false;
85 bool mCanChangeAttributeValue = false;
86
88 QgsField fieldDefinition();
89
91 int mAttributeId;
92
93 QgsMessageBar *mMsgBar = nullptr;
94
95 friend class TestQgsFieldCalculator;
96};
97
98#endif // QGSFIELDCALCULATOR_H
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:154
@ Info
Information message.
Definition qgis.h:155
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:53
A bar for displaying non-blocking messages to the user.
Represents a vector layer which manages a vector based data sets.