QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmultiedittoolbutton.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmultiedittoolbutton.h
3 ------------------------
4 Date : March 2016
5 Copyright : (C) 2016 Nyall Dawson
6 Email : nyall dot dawson at gmail.com
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 QGSMULTIEDITTOOLBUTTON_H
17#define QGSMULTIEDITTOOLBUTTON_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgsfields.h"
22
23#include <QToolButton>
24
34class GUI_EXPORT QgsMultiEditToolButton : public QToolButton
35{
36 Q_OBJECT
37
38 public:
46
51 explicit QgsMultiEditToolButton( QWidget *parent SIP_TRANSFERTHIS = nullptr );
52
56 State state() const { return mState; }
57
63 void setField( const QgsField &field ) { mField = field; }
64
65 public slots:
66
73 void setIsMixed( bool mixed )
74 {
75 mIsMixedValues = mixed;
76 updateState();
77 }
78
85 void setIsChanged( bool changed )
86 {
87 mIsChanged = changed;
88 updateState();
89 }
90
98 {
99 mIsChanged = false;
100 updateState();
101 }
102
108 {
109 mIsMixedValues = false;
110 mIsChanged = false;
111 updateState();
112 }
113
114 signals:
115
118
121
122 private slots:
123
124 void aboutToShowMenu();
125 void setFieldTriggered();
126 void resetFieldTriggered();
127
128 private:
129 bool mIsMixedValues = false;
130 bool mIsChanged = false;
131 State mState = Default;
132 QgsField mField;
133
134 QMenu *mMenu = nullptr;
135
136 void updateState();
137};
138
139#endif // QGSMULTIEDITTOOLBUTTON_H
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:54
A tool button for controlling how edits to multiple features are applied.
void resetChanges()
Resets the changed state for the field.
void setIsMixed(bool mixed)
Sets whether the associated field contains mixed values.
@ Changed
Value for widget has changed but changes have not yet been committed.
@ MixedValues
Mixed state, some features have different values for the widget.
@ Default
Default state, all features have same value for widget.
void changesCommitted()
Called when field values have been changed and field now contains all the same values.
void setIsChanged(bool changed)
Sets whether the associated field has changed.
void resetFieldValueTriggered()
Emitted when the "reset to original values" option is selected.
QgsMultiEditToolButton(QWidget *parent=nullptr)
Constructor for QgsMultiEditToolButton.
State state() const
Returns the current displayed state of the button.
void setFieldValueTriggered()
Emitted when the "set field value for all features" option is selected.
void setField(const QgsField &field)
Sets the field associated with this button.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53