QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 "qgsfields.h"
20#include "qgis_sip.h"
21#include <QToolButton>
22#include "qgis_gui.h"
23
31class GUI_EXPORT QgsMultiEditToolButton : public QToolButton
32{
33 Q_OBJECT
34
35 public:
43
48 explicit QgsMultiEditToolButton( QWidget *parent SIP_TRANSFERTHIS = nullptr );
49
53 State state() const { return mState; }
54
60 void setField( const QgsField &field ) { mField = field; }
61
62 public slots:
63
70 void setIsMixed( bool mixed )
71 {
72 mIsMixedValues = mixed;
73 updateState();
74 }
75
82 void setIsChanged( bool changed )
83 {
84 mIsChanged = changed;
85 updateState();
86 }
87
95 {
96 mIsChanged = false;
97 updateState();
98 }
99
105 {
106 mIsMixedValues = false;
107 mIsChanged = false;
108 updateState();
109 }
110
111 signals:
112
115
118
119 private slots:
120
121 void aboutToShowMenu();
122 void setFieldTriggered();
123 void resetFieldTriggered();
124
125 private:
126 bool mIsMixedValues = false;
127 bool mIsChanged = false;
128 State mState = Default;
129 QgsField mField;
130
131 QMenu *mMenu = nullptr;
132
133 void updateState();
134};
135
136#endif // QGSMULTIEDITTOOLBUTTON_H
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:53
A tool button widget which is displayed next to editor widgets in attribute forms,...
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.
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