The QLCDNumber widget displays a number with LCD-like digits. More...
#include <qlcdnumber.h>
Inherits QFrame.
Type | Name | READ | WRITE | Options |
---|---|---|---|---|
bool | smallDecimalPoint | smallDecimalPoint | setSmallDecimalPoint | |
int | numDigits | numDigits | setNumDigits | |
Mode | mode | mode | setMode | |
SegmentStyle | segmentStyle | segmentStyle | setSegmentStyle | |
double | value | value | display | |
int | intValue | intValue | display |
It can display a number in just about any size, in decimal, hexadecimal, octal or binary notation, and is easy to connect to data sources via the display() slot, which is overloaded to take any of five argument types.
There are also slots to change the notation mode and decimal point mode.
QLCDNumber emits the overflow() signal when it is asked to display something beyond its range. The range is set by setNumDigits() (but setSmallDecimalPoint() influences it too).
These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. QLCDNumber substitutes spaces for illegal characters.
It is not possible to retrieve the contents of a QLCDNumber object. If you need to, we recommend that you connect the signals which feed the display() slot to another slot as well and store the value there.
Incidentally, QLCDNumber is the very oldest part of Qt, tracing back to a BASIC program on the Sinclair Spectrum.
Examples: xform/xform.cpp
Hex
- Hexadecimal
Dec
- Decimal
Oct
- Octal
Bin
- Binary
Outline
gives raised segments filled with the background brush.
Filled
gives raised segments filled with the foreground brush.
Flat
gives flat segments filled with the foreground brush.
Constructs an LCD number, sets the number of digits to 5, the base
to decimal, the decimal point mode to 'small' and the frame style to
a raised box. The segmentStyle() is set to Outline.
The parent and name arguments are passed to the QFrame constructor.
See also setNumDigits() and setSmallDecimalPoint().
Constructs an LCD number, sets the number of digits to numDigits, the
base to decimal, the decimal point mode to 'small' and the frame style
to a raised box. The segmentStyle() is set to Outline.
The parent and name arguments are passed to the QFrame constructor.
See also setNumDigits() and setSmallDecimalPoint().
Destructs the LCD number.
Returns TRUE if num is too big to be displayed in its entirety, FALSE otherwise.
See also display(), numDigits() and smallDecimalPoint().
Returns TRUE if num is too big to be displayed in its entirety, FALSE otherwise.
See also display(), numDigits() and smallDecimalPoint().
[slot]
Sets the contents of the display to num.
See also setMode() and smallDecimalPoint().
Examples: xform/xform.cpp
[slot]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This version of the function disregards mode() and smallDecimalPoint().
These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. QLCDNumber substitutes spaces for illegal characters.
[slot]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[virtual protected]
Draws the LCD number using painter p. This function is called from QFrame::paintEvent().
Reimplemented from QFrame.
Returns the last value set by one of the display() slots rounded to the nearest integer.
If display(QString ) was the last called, 0 is returned.
See also value() and display().
Returns the current display mode, which is one of BIN, OCT, DEC
and HEX.
See also setMode() and smallDecimalPoint().
Returns the current number of digits. If smallDecimalPoint() is FALSE, the decimal point occupies one digit position.
See also setNumDigits() and smallDecimalPoint().
[signal]
This signal is emitted whenever the QLCDNumber is asked to display a too large number or a too long string.
It is never emitted by setNumDigits().
Returns the style of the QLCDNumber.
See also setSegmentStyle().
[virtual slot]
Calls setMode( BIN ). Provided for convenience (e.g. for connecting buttons to this).
See also setMode(), setHexMode(), setDecMode(), setOctMode() and mode().
[virtual slot]
Calls setMode( DEC ). Provided for convenience (e.g. for connecting buttons to this).
See also setMode(), setHexMode(), setOctMode(), setBinMode() and mode().
[virtual slot]
Calls setMode( HEX ). Provided for convenience (e.g. for connecting buttons to this).
See also setMode(), setDecMode(), setOctMode(), setBinMode() and mode().
Sets the display mode to m, which must be one of BIN, OCT, DEC
and HEX.
All four modes can display both integers, floating-point
numbers and strings (subject to character set limitations).
Example:
myLcd.setMode( QLCDNumber::HEX );
See also mode(), setHexMode(), setDecMode(), setOctMode(), setBinMode(), setSmallDecimalPoint() and display().
[virtual]
Sets the number of digits shown to numDigits, which is forced into the [0-99] range.
If smallDecimalPoint() is TRUE, numDigits can be shown. If it is FALSE, only numDigits-1 digits can be shown.
See also numDigits(), setMode(), setSmallDecimalPoint() and overflow().
[virtual slot]
Calls setMode( OCT ). Provided for convenience (e.g. for connecting buttons to this).
See also setMode(), setHexMode(), setDecMode(), setBinMode() and mode().
Sets the style of the QLCDNumber to s.
Outline
gives raised segments filled with the background color.
Filled
gives raised segments filled with the foreground color.
Flat
gives flat segments filled with the foreground color.
Outline
and Filled
will additionally use QColorGroup::light()
and QColorGroup::dark() for shadow effects.
See also segmentStyle().
[virtual slot]
If b is TRUE, the decimal point is drawn between two digits. If b is FALSE, the decimal point is drawn in a digit position.
The inter-digit space is made slightly wider when the decimal point is drawn between the digits.
See also smallDecimalPoint() and setMode().
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Returns TRUE if the decimal point is currently drawn between two digit positions, and FALSE if it is drawn in a digit position.
See also setSmallDecimalPoint() and mode().
Returns the last value set by one of the display() slots.
If display(QString ) was the last called, 0 is returned.
See also intValue() and display().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version 2.2.1
|