QtiPlot
0.9.8.2
Main Page
Related Pages
Classes
Files
File List
File Members
qtiplot
src
lib
include
DoubleSpinBox.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : DoubleSpinBox.h
3
Project : QtiPlot
4
--------------------------------------------------------------------
5
Copyright : (C) 2007-2008 by Ion Vasilief
6
Email (use @ for *) : ion_vasilief*yahoo.fr
7
Description : A Double Spin Box
8
9
***************************************************************************/
10
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
22
* *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
27
* *
28
***************************************************************************/
29
#ifndef DoubleSpinBox_H
30
#define DoubleSpinBox_H
31
32
#include <QAbstractSpinBox>
33
#include <QCheckBox>
34
36
39
class
DoubleSpinBox
:
public
QAbstractSpinBox
40
{
41
Q_OBJECT
42
43
public
:
45
49
DoubleSpinBox
(
const
char
format =
'g'
, QWidget * parent = 0);
50
51
void
setSingleStep
(
double
val);
52
void
setMaximum
(
double
max);
53
void
setMinimum
(
double
min
);
54
void
setRange
(
double
min,
double
max);
55
56
int
decimals
(){
return
d_prec
;};
57
void
setDecimals
(
int
prec){
if
(prec >= 0)
d_prec
= prec;};
58
59
double
value
(){
interpretText
();
return
d_value
;};
60
bool
setValue
(
double
val);
61
62
QString
prefix
()
const
;
63
void
setPrefix
(
const
QString &
prefix
){
d_prefix
=
prefix
;}
64
65
void
setFormat
(
const
char
format,
int
prec = 1){
d_format
= format;
setDecimals
(prec);};
66
67
QString
textFromValue
(
double
value
)
const
;
68
virtual
QValidator::State
validate
( QString & input,
int
& pos )
const
;
69
70
signals:
71
void
valueChanged
(
double
d );
73
void
activated
(
DoubleSpinBox
*);
74
75
private
slots:
76
void
interpretText
();
77
78
protected
:
79
void
stepBy
(
int
steps );
80
StepEnabled
stepEnabled
()
const
;
81
void
focusInEvent
(QFocusEvent *);
82
83
private
:
84
char
d_format
;
85
double
d_min_val
;
86
double
d_max_val
;
87
double
d_value
;
88
double
d_step
;
89
int
d_prec
;
90
QString
d_prefix
;
91
};
92
94
class
RangeLimitBox
:
public
QWidget
95
{
96
public
:
97
enum
LimitType
{
LeftLimit
,
RightLimit
};
98
99
RangeLimitBox
(
LimitType
type, QWidget * parent = 0);
100
void
setDecimals
(
int
prec){
d_spin_box
->
setDecimals
(prec);};
101
double
value
();
102
bool
isChecked
(){
return
d_checkbox
->isChecked();};
103
104
private
:
105
DoubleSpinBox
*
d_spin_box
;
106
QCheckBox *
d_checkbox
;
107
LimitType
d_type
;
108
};
109
#endif // FITDIALOG_H
Generated on Tue Dec 10 2013 17:29:14 for QtiPlot by
1.8.4