author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 16 Apr 2010 15:50:13 +0300 | |
changeset 18 | 2f34d5167611 |
parent 3 | 41300fa6a67c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QLCDNUMBER_H |
|
43 |
#define QLCDNUMBER_H |
|
44 |
||
45 |
#include <QtGui/qframe.h> |
|
46 |
#include <QtCore/qbitarray.h> |
|
47 |
||
48 |
QT_BEGIN_HEADER |
|
49 |
||
50 |
QT_BEGIN_NAMESPACE |
|
51 |
||
52 |
QT_MODULE(Gui) |
|
53 |
||
54 |
#ifndef QT_NO_LCDNUMBER |
|
55 |
||
56 |
class QLCDNumberPrivate; |
|
57 |
class Q_GUI_EXPORT QLCDNumber : public QFrame // LCD number widget |
|
58 |
{ |
|
59 |
Q_OBJECT |
|
60 |
Q_ENUMS(Mode SegmentStyle) |
|
61 |
Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint) |
|
62 |
Q_PROPERTY(int numDigits READ numDigits WRITE setNumDigits) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount) |
0 | 64 |
Q_PROPERTY(Mode mode READ mode WRITE setMode) |
65 |
Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle) |
|
66 |
Q_PROPERTY(double value READ value WRITE display) |
|
67 |
Q_PROPERTY(int intValue READ intValue WRITE display) |
|
68 |
||
69 |
public: |
|
70 |
explicit QLCDNumber(QWidget* parent = 0); |
|
71 |
explicit QLCDNumber(uint numDigits, QWidget* parent = 0); |
|
72 |
~QLCDNumber(); |
|
73 |
||
74 |
enum Mode { |
|
75 |
Hex, Dec, Oct, Bin |
|
76 |
#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) |
|
77 |
, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin |
|
78 |
#endif |
|
79 |
}; |
|
80 |
enum SegmentStyle { |
|
81 |
Outline, Filled, Flat |
|
82 |
}; |
|
83 |
||
84 |
bool smallDecimalPoint() const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
#ifdef QT_DEPRECATED |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
QT_DEPRECATED int numDigits() const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
QT_DEPRECATED void setNumDigits(int nDigits); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
#endif |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
int digitCount() const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
void setDigitCount(int nDigits); |
0 | 91 |
|
92 |
bool checkOverflow(double num) const; |
|
93 |
bool checkOverflow(int num) const; |
|
94 |
||
95 |
Mode mode() const; |
|
96 |
void setMode(Mode); |
|
97 |
||
98 |
SegmentStyle segmentStyle() const; |
|
99 |
void setSegmentStyle(SegmentStyle); |
|
100 |
||
101 |
double value() const; |
|
102 |
int intValue() const; |
|
103 |
||
104 |
QSize sizeHint() const; |
|
105 |
||
106 |
public Q_SLOTS: |
|
107 |
void display(const QString &str); |
|
108 |
void display(int num); |
|
109 |
void display(double num); |
|
110 |
void setHexMode(); |
|
111 |
void setDecMode(); |
|
112 |
void setOctMode(); |
|
113 |
void setBinMode(); |
|
114 |
void setSmallDecimalPoint(bool); |
|
115 |
||
116 |
Q_SIGNALS: |
|
117 |
void overflow(); |
|
118 |
||
119 |
protected: |
|
120 |
bool event(QEvent *e); |
|
121 |
void paintEvent(QPaintEvent *); |
|
122 |
||
123 |
public: |
|
124 |
#ifdef QT3_SUPPORT |
|
125 |
QT3_SUPPORT_CONSTRUCTOR QLCDNumber(QWidget* parent, const char* name); |
|
126 |
QT3_SUPPORT_CONSTRUCTOR QLCDNumber(uint numDigits, QWidget* parent, const char* name); |
|
127 |
||
128 |
QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } |
|
129 |
QT3_SUPPORT int margin() const |
|
130 |
{ int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } |
|
131 |
#endif |
|
132 |
||
133 |
private: |
|
134 |
Q_DISABLE_COPY(QLCDNumber) |
|
135 |
Q_DECLARE_PRIVATE(QLCDNumber) |
|
136 |
}; |
|
137 |
||
138 |
#endif // QT_NO_LCDNUMBER |
|
139 |
||
140 |
QT_END_NAMESPACE |
|
141 |
||
142 |
QT_END_HEADER |
|
143 |
||
144 |
#endif // QLCDNUMBER_H |