QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
gui
editorwidgets
qgsdoublespinbox.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdoublespinbox.h
3
--------------------------------------
4
Date : 09.2014
5
Copyright : (C) 2014 Denis Rouzaud
6
Email :
[email protected]
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 QGSDOUBLESPINBOX_H
17
#define QGSDOUBLESPINBOX_H
18
19
#include <QDoubleSpinBox>
20
21
class
QgsSpinBoxLineEdit;
22
28
class
GUI_EXPORT
QgsDoubleSpinBox
:
public
QDoubleSpinBox
29
{
30
Q_OBJECT
31
Q_PROPERTY(
bool
showClearButton READ showClearButton WRITE setShowClearButton )
32
Q_PROPERTY(
bool
clearValue READ clearValue WRITE setClearValue )
33
Q_PROPERTY(
bool
expressionsEnabled READ expressionsEnabled WRITE setExpressionsEnabled )
34
35
public:
36
38
enum
ClearValueMode
39
{
40
MinimumValue
,
41
MaximumValue
,
42
CustomValue
,
43
};
44
48
explicit
QgsDoubleSpinBox
(
QWidget
*parent =
nullptr
);
49
55
void
setShowClearButton(
const
bool
showClearButton );
56
60
bool
showClearButton
()
const
{
return
mShowClearButton;}
61
67
void
setExpressionsEnabled(
const
bool
enabled );
68
74
bool
expressionsEnabled
()
const
{
return
mExpressionsEnabled;}
75
77
virtual
void
clear
()
override
;
78
85
void
setClearValue(
double
customValue,
const
QString
& clearValueText =
QString
() );
86
92
void
setClearValueMode(
ClearValueMode
mode,
const
QString
& clearValueText =
QString
() );
93
97
double
clearValue()
const
;
98
99
virtual
double
valueFromText
(
const
QString
& text )
const override
;
100
virtual
QValidator::State
validate
(
QString
& input,
int
& pos )
const override
;
101
void
paintEvent
(
QPaintEvent
* e )
override
;
102
103
protected
:
104
virtual
void
changeEvent
(
QEvent
* event )
override
;
105
106
private
slots:
107
void
changed(
double
value );
108
109
private
:
110
int
frameWidth()
const
;
111
bool
shouldShowClearForValue(
const
double
value )
const
;
112
113
QgsSpinBoxLineEdit* mLineEdit;
114
115
bool
mShowClearButton;
116
ClearValueMode
mClearValueMode;
117
double
mCustomClearValue;
118
119
bool
mExpressionsEnabled;
120
121
QString
stripped(
const
QString
&originalText )
const
;
122
};
123
124
#endif // QGSDOUBLESPINBOX_H
QgsDoubleSpinBox
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
Definition:
qgsdoublespinbox.h:28
QDoubleSpinBox::validate
virtual QValidator::State validate(QString &text, int &pos) const
QEvent
QWidget
QAbstractSpinBox::clear
virtual void clear()
QgsDoubleSpinBox::CustomValue
Reset value to custom value (see setClearValue() )
Definition:
qgsdoublespinbox.h:42
QgsDoubleSpinBox::MaximumValue
Reset value to maximum()
Definition:
qgsdoublespinbox.h:41
QgsDoubleSpinBox::ClearValueMode
ClearValueMode
Behaviour when widget is cleared.
Definition:
qgsdoublespinbox.h:38
QDoubleSpinBox
QgsDoubleSpinBox::showClearButton
bool showClearButton() const
Returns whether the widget is showing a clear button.
Definition:
qgsdoublespinbox.h:60
QString
QgsDoubleSpinBox::expressionsEnabled
bool expressionsEnabled() const
Returns whether the widget will allow entry of simple expressions, which are evaluated and then disca...
Definition:
qgsdoublespinbox.h:74
QAbstractSpinBox::paintEvent
virtual void paintEvent(QPaintEvent *event)
QAbstractSpinBox::changeEvent
virtual void changeEvent(QEvent *event)
QDoubleSpinBox::valueFromText
virtual double valueFromText(const QString &text) const
QgsDoubleSpinBox::MinimumValue
Reset value to minimum()
Definition:
qgsdoublespinbox.h:40
QPaintEvent
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13