Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
src_gui_widgets_qspinbox.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
//! [0]
5
sb->setPrefix(
"$"
);
6
//! [0]
7
8
9
//! [1]
10
sb->setSuffix(
" km"
);
11
//! [1]
12
13
14
//! [2]
15
setRange
(
minimum
,
maximum
);
16
//! [2]
17
18
19
//! [3]
20
setMinimum
(
minimum
);
21
setMaximum
(
maximum
);
22
//! [3]
23
24
25
//! [4]
26
spinbox->setPrefix(
"$"
);
27
//! [4]
28
29
30
//! [5]
31
spinbox->setSuffix(
" km"
);
32
//! [5]
33
34
35
//! [6]
36
setRange(
minimum
, maximum);
37
//! [6]
38
39
40
//! [7]
41
setMinimum
(
minimum
);
42
setMaximum
(
maximum
);
43
//! [7]
44
45
//! [8]
46
int
IconSizeSpinBox::valueFromText(
const
QString &text)
const
47
{
48
static
const
QRegularExpression regExp(tr(
"(\\d+)(\\s*[xx]\\s*\\d+)?"
));
49
Q_ASSERT(regExp.isValid());
50
51
const
QRegularExpressionMatch match = regExp.match(text);
52
if
(match.isValid())
53
return
match.captured(1).toInt();
54
return
0;
55
}
56
//! [8]
57
58
//! [9]
59
QString IconSizeSpinBox::textFromValue(
int
value)
const
60
{
61
return
tr(
"%1 x %1"
).arg(value);
62
}
63
//! [9]
setMaximum
setMaximum(maximum)
setMinimum
setMinimum(minimum)
[2]
setRange
setRange(minimum, maximum)
[1]
qtbase
src
widgets
doc
snippets
code
src_gui_widgets_qspinbox.cpp
Generated on
for Qt by
1.18.0