QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
gui
editorwidgets
qgsspinbox.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsspinbox.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 QGSSPINBOX_H
17
#define QGSSPINBOX_H
18
19
#include <QSpinBox>
20
21
class
QgsSpinBoxLineEdit;
22
28
class
GUI_EXPORT
QgsSpinBox
:
public
QSpinBox
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
QgsSpinBox
(
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(
int
customValue,
const
QString
& clearValueText =
QString
() );
86
92
void
setClearValueMode(
ClearValueMode
mode,
const
QString
& clearValueText =
QString
() );
93
97
int
clearValue()
const
;
98
99
virtual
int
valueFromText
(
const
QString
& text )
const override
;
100
virtual
QValidator::State
validate
(
QString
& input,
int
& pos )
const override
;
101
102
protected
:
103
104
virtual
void
changeEvent
(
QEvent
* event )
override
;
105
virtual
void
paintEvent
(
QPaintEvent
* event )
override
;
106
107
private
slots:
108
void
changed(
int
value );
109
110
private
:
111
int
frameWidth()
const
;
112
bool
shouldShowClearForValue(
const
int
value )
const
;
113
114
QgsSpinBoxLineEdit* mLineEdit;
115
116
bool
mShowClearButton;
117
ClearValueMode
mClearValueMode;
118
int
mCustomClearValue;
119
120
bool
mExpressionsEnabled;
121
122
QString
stripped(
const
QString
&originalText )
const
;
123
};
124
125
#endif // QGSSPINBOX_H
QEvent
QWidget
QAbstractSpinBox::clear
virtual void clear()
QgsSpinBox::ClearValueMode
ClearValueMode
Behaviour when widget is cleared.
Definition:
qgsspinbox.h:38
QgsSpinBox::MaximumValue
Reset value to maximum()
Definition:
qgsspinbox.h:41
QgsSpinBox::CustomValue
Reset value to custom value (see setClearValue() )
Definition:
qgsspinbox.h:42
QgsSpinBox::showClearButton
bool showClearButton() const
Returns whether the widget is showing a clear button.
Definition:
qgsspinbox.h:60
QgsSpinBox
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
Definition:
qgsspinbox.h:28
QgsSpinBox::expressionsEnabled
bool expressionsEnabled() const
Returns whether the widget will allow entry of simple expressions, which are evaluated and then disca...
Definition:
qgsspinbox.h:74
QgsSpinBox::MinimumValue
Reset value to minimum()
Definition:
qgsspinbox.h:40
QString
QSpinBox
QSpinBox::valueFromText
virtual int valueFromText(const QString &text) const
QSpinBox::validate
virtual QValidator::State validate(QString &text, int &pos) const
QAbstractSpinBox::paintEvent
virtual void paintEvent(QPaintEvent *event)
QAbstractSpinBox::changeEvent
virtual void changeEvent(QEvent *event)
QPaintEvent
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13