1QLCDNumber(3qt) QLCDNumber(3qt)
2
3
4
6 QLCDNumber - Displays a number with LCD-like digits
7
9 #include <qlcdnumber.h>
10
11 Inherits QFrame.
12
13 Public Members
14 QLCDNumber ( QWidget * parent = 0, const char * name = 0 )
15 QLCDNumber ( uint numDigits, QWidget * parent = 0, const char * name =
16 0 )
17 ~QLCDNumber ()
18 enum Mode { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN =
19 Bin }
20 enum SegmentStyle { Outline, Filled, Flat }
21 bool smallDecimalPoint () const
22 int numDigits () const
23 virtual void setNumDigits ( int nDigits )
24 bool checkOverflow ( double num ) const
25 bool checkOverflow ( int num ) const
26 Mode mode () const
27 virtual void setMode ( Mode )
28 SegmentStyle segmentStyle () const
29 virtual void setSegmentStyle ( SegmentStyle )
30 double value () const
31 int intValue () const
32
33 Public Slots
34 void display ( const QString & s )
35 void display ( int num )
36 void display ( double num )
37 virtual void setHexMode ()
38 virtual void setDecMode ()
39 virtual void setOctMode ()
40 virtual void setBinMode ()
41 virtual void setSmallDecimalPoint ( bool )
42
43 Signals
44 void overflow ()
45
46 Properties
47 int intValue - the displayed value rounded to the nearest integer
48 Mode mode - the current display mode (number base)
49 int numDigits - the current number of digits displayed
50 SegmentStyle segmentStyle - the style of the LCDNumber
51 bool smallDecimalPoint - the style of the decimal point
52 double value - the displayed value
53
54 Protected Members
55 virtual void drawContents ( QPainter * p )
56
58 The QLCDNumber widget displays a number with LCD-like digits.
59
60 It can display a number in just about any size. It can display decimal,
61 hexadecimal, octal or binary numbers. It is easy to connect to data
62 sources using the display() slot, which is overloaded to take any of
63 five argument types.
64
65 There are also slots to change the base with setMode() and the decimal
66 point with setSmallDecimalPoint().
67
68 QLCDNumber emits the overflow() signal when it is asked to display
69 something beyond its range. The range is set by setNumDigits(), but
70 setSmallDecimalPoint() also influences it. If the display is set to
71 hexadecimal, octal or binary, the integer equivalent of the value is
72 displayed.
73
74 These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6,
75 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u,
76 U, Y, colon, degree sign (which is specified as single quote in the
77 string) and space. QLCDNumber substitutes spaces for illegal
78 characters.
79
80 It is not possible to retrieve the contents of a QLCDNumber object,
81 although you can retrieve the numeric value with value(). If you really
82 need the text, we recommend that you connect the signals that feed the
83 display() slot to another slot as well and store the value there.
84
85 Incidentally, QLCDNumber is the very oldest part of Qt, tracing back to
86 a BASIC program on the Sinclair Spectrum.
87
88 [Image Omitted]
89
90 [Image Omitted]
91
92 See also QLabel, QFrame, and Basic Widgets.
93
94 Member Type Documentation
96 This type determines how numbers are shown.
97
98 QLCDNumber::Hex - Hexadecimal
99
100 QLCDNumber::Dec - Decimal
101
102 QLCDNumber::Oct - Octal
103
104 QLCDNumber::Bin - Binary
105
106 If the display is set to hexadecimal, octal or binary, the integer
107 equivalent of the value is displayed.
108
110 This type determines the visual appearance of the QLCDNumber widget.
111
112 QLCDNumber::Outline - gives raised segments filled with the background
113 brush.
114
115 QLCDNumber::Filled - gives raised segments filled with the foreground
116 brush.
117
118 QLCDNumber::Flat - gives flat segments filled with the foreground
119 brush.
120
123 Constructs an LCD number, sets the number of digits to 5, the base to
124 decimal, the decimal point mode to 'small' and the frame style to a
125 raised box. The segmentStyle() is set to Outline.
126
127 The parent and name arguments are passed to the QFrame constructor.
128
129 See also numDigits and smallDecimalPoint.
130
132 name = 0 )
133 Constructs an LCD number, sets the number of digits to numDigits, the
134 base to decimal, the decimal point mode to 'small' and the frame style
135 to a raised box. The segmentStyle() is set to Outline.
136
137 The parent and name arguments are passed to the QFrame constructor.
138
139 See also numDigits and smallDecimalPoint.
140
142 Destroys the LCD number.
143
145 Returns TRUE if num is too big to be displayed in its entirety;
146 otherwise returns FALSE.
147
148 See also display(), numDigits, and smallDecimalPoint.
149
151 This is an overloaded member function, provided for convenience. It
152 behaves essentially like the above function.
153
154 Returns TRUE if num is too big to be displayed in its entirety;
155 otherwise returns FALSE.
156
157 See also display(), numDigits, and smallDecimalPoint.
158
160 Displays the number represented by the string s.
161
162 This version of the function disregards mode() and smallDecimalPoint().
163
164 These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6,
165 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u,
166 U, Y, colon, degree sign (which is specified as single quote in the
167 string) and space. QLCDNumber substitutes spaces for illegal
168 characters.
169
170 Examples:
171
173 Sets the displayed value rounded to the nearest integer to num. See the
174 "intValue" property for details.
175
177 This is an overloaded member function, provided for convenience. It
178 behaves essentially like the above function.
179
180 Displays the number num.
181
183 Draws the LCD number using painter p. This function is called from
184 QFrame::paintEvent().
185
186 Reimplemented from QFrame.
187
189 Returns the displayed value rounded to the nearest integer. See the
190 "intValue" property for details.
191
193 Returns the current display mode (number base). See the "mode" property
194 for details.
195
197 Returns the current number of digits displayed. See the "numDigits"
198 property for details.
199
201 This signal is emitted whenever the QLCDNumber is asked to display a
202 too-large number or a too-long string.
203
204 It is never emitted by setNumDigits().
205
207 Returns the style of the LCDNumber. See the "segmentStyle" property for
208 details.
209
211 Calls setMode( BIN ). Provided for convenience (e.g. for connecting
212 buttons to it).
213
214 See also mode, setHexMode(), setDecMode(), setOctMode(), and mode.
215
217 Calls setMode( DEC ). Provided for convenience (e.g. for connecting
218 buttons to it).
219
220 See also mode, setHexMode(), setOctMode(), setBinMode(), and mode.
221
223 Calls setMode( HEX ). Provided for convenience (e.g. for connecting
224 buttons to it).
225
226 See also mode, setDecMode(), setOctMode(), setBinMode(), and mode.
227
229 Sets the current display mode (number base). See the "mode" property
230 for details.
231
233 Sets the current number of digits displayed to nDigits. See the
234 "numDigits" property for details.
235
237 Calls setMode( OCT ). Provided for convenience (e.g. for connecting
238 buttons to it).
239
240 See also mode, setHexMode(), setDecMode(), setBinMode(), and mode.
241
243 Sets the style of the LCDNumber. See the "segmentStyle" property for
244 details.
245
247 Sets the style of the decimal point. See the "smallDecimalPoint"
248 property for details.
249
251 Returns the style of the decimal point. See the "smallDecimalPoint"
252 property for details.
253
255 Returns the displayed value. See the "value" property for details.
256
257 Property Documentation
259 This property holds the displayed value rounded to the nearest integer.
260
261 This property corresponds to the nearest integer to the current value
262 displayed by the LCDNumber. This is the value used for hexadecimal,
263 octal and binary modes.
264
265 If the displayed value is not a number, the property has a value of 0.
266
267 Set this property's value with display() and get this property's value
268 with intValue().
269
271 This property holds the current display mode (number base).
272
273 Corresponds to the current display mode, which is one of BIN, OCT, DEC
274 (the default) and HEX. DEC mode can display floating point values, the
275 other modes display the integer equivalent.
276
277 See also smallDecimalPoint, setHexMode(), setDecMode(), setOctMode(),
278 and setBinMode().
279
280 Set this property's value with setMode() and get this property's value
281 with mode().
282
284 This property holds the current number of digits displayed.
285
286 Corresponds to the current number of digits. If
287 QLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies one
288 digit position.
289
290 See also smallDecimalPoint.
291
292 Set this property's value with setNumDigits() and get this property's
293 value with numDigits().
294
296 This property holds the style of the LCDNumber.
297
298 <center>.nf
299
300 </center>
301
302 Outline and Filled will additionally use QColorGroup::light() and
303 QColorGroup::dark() for shadow effects.
304
305 Set this property's value with setSegmentStyle() and get this
306 property's value with segmentStyle().
307
309 This property holds the style of the decimal point.
310
311 If TRUE the decimal point is drawn between two digit positions.
312 Otherwise it occupies a digit position of its own, i.e. is drawn in a
313 digit position. The default is FALSE.
314
315 The inter-digit space is made slightly wider when the decimal point is
316 drawn between the digits.
317
318 See also mode.
319
320 Set this property's value with setSmallDecimalPoint() and get this
321 property's value with smallDecimalPoint().
322
324 This property holds the displayed value.
325
326 This property corresponds to the current value displayed by the
327 LCDNumber.
328
329 If the displayed value is not a number, the property has a value of 0.
330
331 Set this property's value with display() and get this property's value
332 with value().
333
334
336 http://doc.trolltech.com/qlcdnumber.html
337 http://www.trolltech.com/faq/tech.html
338
340 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
341 license file included in the distribution for a complete license
342 statement.
343
345 Generated automatically from the source code.
346
348 If you find a bug in Qt, please report it as described in
349 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
350 help you. Thank you.
351
352 The definitive Qt documentation is provided in HTML format; it is
353 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
354 web browser. This man page is provided as a convenience for those users
355 who prefer man pages, although this format is not officially supported
356 by Trolltech.
357
358 If you find errors in this manual page, please report them to qt-
359 bugs@trolltech.com. Please include the name of the manual page
360 (qlcdnumber.3qt) and the Qt version (3.3.8).
361
362
363
364Trolltech AS 2 February 2007 QLCDNumber(3qt)