Eneboo - Documentación para desarrolladores
|
The QLCDNumber widget displays a number with LCD-like digits. Más...
#include <qlcdnumber.h>
Tipos públicos | |
enum | Mode { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin, Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin } |
enum | SegmentStyle { Outline, Filled, Flat, Outline, Filled, Flat } |
enum | Mode { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin, Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin } |
enum | SegmentStyle { Outline, Filled, Flat, Outline, Filled, Flat } |
Slots públicos | |
void | display (const QString &str) |
void | display (int num) |
void | display (double num) |
virtual void | setHexMode () |
virtual void | setDecMode () |
virtual void | setOctMode () |
virtual void | setBinMode () |
virtual void | setSmallDecimalPoint (bool) |
void | display (const QString &str) |
void | display (int num) |
void | display (double num) |
virtual void | setHexMode () |
virtual void | setDecMode () |
virtual void | setOctMode () |
virtual void | setBinMode () |
virtual void | setSmallDecimalPoint (bool) |
Señales | |
void | overflow () |
void | overflow () |
Métodos públicos | |
QLCDNumber (QWidget *parent=0, const char *name=0) | |
QLCDNumber (uint numDigits, QWidget *parent=0, const char *name=0) | |
~QLCDNumber () | |
bool | smallDecimalPoint () const |
int | numDigits () const |
virtual void | setNumDigits (int nDigits) |
bool | checkOverflow (double num) const |
bool | checkOverflow (int num) const |
Mode | mode () const |
virtual void | setMode (Mode) |
SegmentStyle | segmentStyle () const |
virtual void | setSegmentStyle (SegmentStyle) |
double | value () const |
int | intValue () const |
QSize | sizeHint () const |
QLCDNumber (QWidget *parent=0, const char *name=0) | |
QLCDNumber (uint numDigits, QWidget *parent=0, const char *name=0) | |
~QLCDNumber () | |
bool | smallDecimalPoint () const |
int | numDigits () const |
virtual void | setNumDigits (int nDigits) |
bool | checkOverflow (double num) const |
bool | checkOverflow (int num) const |
Mode | mode () const |
virtual void | setMode (Mode) |
SegmentStyle | segmentStyle () const |
virtual void | setSegmentStyle (SegmentStyle) |
double | value () const |
int | intValue () const |
QSize | sizeHint () const |
Métodos protegidos | |
void | drawContents (QPainter *) |
void | drawContents (QPainter *) |
Propiedades | |
bool | smallDecimalPoint |
the style of the decimal point | |
int | numDigits |
the current number of digits displayed | |
Mode | mode |
the current display mode (number base) | |
SegmentStyle | segmentStyle |
the style of the LCDNumber | |
double | value |
the displayed value | |
int | intValue |
the displayed value rounded to the nearest integer |
The QLCDNumber widget displays a number with LCD-like digits.
It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to connect to data sources using the display() slot, which is overloaded to take any of five argument types.
There are also slots to change the base with setMode() and the decimal point with setSmallDecimalPoint().
QLCDNumber emits the overflow() signal when it is asked to display something beyond its range. The range is set by setNumDigits(), but setSmallDecimalPoint() also influences it. If the display is set to hexadecimal, octal or binary, the integer equivalent of the value is displayed.
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, although you can retrieve the numeric value with value(). If you really need the text, we recommend that you connect the signals that 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.
enum QLCDNumber::Mode |
enum QLCDNumber::Mode |
This type determines the visual appearance of the QLCDNumber widget.
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.
QLCDNumber::QLCDNumber | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
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.
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.
QLCDNumber::~QLCDNumber | ( | ) |
Destroys the LCD number.
QLCDNumber::QLCDNumber | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
QLCDNumber::~QLCDNumber | ( | ) |
bool QLCDNumber::checkOverflow | ( | double | num | ) | const |
Returns TRUE if num is too big to be displayed in its entirety; otherwise returns FALSE.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns TRUE if num is too big to be displayed in its entirety; otherwise returns FALSE.
bool QLCDNumber::checkOverflow | ( | double | num | ) | const |
void QLCDNumber::display | ( | const QString & | str | ) | [slot] |
void QLCDNumber::display | ( | int | num | ) | [slot] |
void QLCDNumber::display | ( | double | num | ) | [slot] |
void QLCDNumber::display | ( | const QString & | s | ) | [slot] |
Displays the number represented by the string s.
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.
void QLCDNumber::display | ( | int | num | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Displays the number num.
void QLCDNumber::display | ( | double | num | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Displays the number num.
void QLCDNumber::drawContents | ( | QPainter * | p | ) | [protected, virtual] |
Draws the LCD number using painter p. This function is called from QFrame::paintEvent().
Reimplementado de QFrame.
void QLCDNumber::drawContents | ( | QPainter * | ) | [protected, virtual] |
Virtual function that draws the contents of the frame.
The QPainter is already open when you get it, and you must leave it open. Painter transformations are switched off on entry. If you transform the painter, remember to take the frame into account and reset transformation before returning.
This function is reimplemented by subclasses that draw something inside the frame. It should only draw inside contentsRect(). The default function does nothing.
Reimplementado de QFrame.
int QLCDNumber::intValue | ( | ) | const |
int QLCDNumber::intValue | ( | ) | const |
Mode QLCDNumber::mode | ( | ) | const |
Mode QLCDNumber::mode | ( | ) | const |
int QLCDNumber::numDigits | ( | ) | const |
int QLCDNumber::numDigits | ( | ) | const |
void QLCDNumber::overflow | ( | ) | [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().
void QLCDNumber::overflow | ( | ) | [signal] |
SegmentStyle QLCDNumber::segmentStyle | ( | ) | const |
SegmentStyle QLCDNumber::segmentStyle | ( | ) | const |
void QLCDNumber::setBinMode | ( | ) | [virtual, slot] |
Calls setMode( BIN ). Provided for convenience (e.g. for connecting buttons to it).
virtual void QLCDNumber::setBinMode | ( | ) | [virtual, slot] |
void QLCDNumber::setDecMode | ( | ) | [virtual, slot] |
Calls setMode( DEC ). Provided for convenience (e.g. for connecting buttons to it).
virtual void QLCDNumber::setDecMode | ( | ) | [virtual, slot] |
void QLCDNumber::setHexMode | ( | ) | [virtual, slot] |
Calls setMode( HEX ). Provided for convenience (e.g. for connecting buttons to it).
virtual void QLCDNumber::setHexMode | ( | ) | [virtual, slot] |
virtual void QLCDNumber::setMode | ( | Mode | ) | [virtual] |
void QLCDNumber::setMode | ( | Mode | m | ) | [virtual] |
virtual void QLCDNumber::setNumDigits | ( | int | nDigits | ) | [virtual] |
void QLCDNumber::setNumDigits | ( | int | nDigits | ) | [virtual] |
void QLCDNumber::setOctMode | ( | ) | [virtual, slot] |
Calls setMode( OCT ). Provided for convenience (e.g. for connecting buttons to it).
virtual void QLCDNumber::setOctMode | ( | ) | [virtual, slot] |
void QLCDNumber::setSegmentStyle | ( | SegmentStyle | s | ) | [virtual] |
virtual void QLCDNumber::setSegmentStyle | ( | SegmentStyle | ) | [virtual] |
void QLCDNumber::setSmallDecimalPoint | ( | bool | b | ) | [virtual, slot] |
virtual void QLCDNumber::setSmallDecimalPoint | ( | bool | ) | [virtual, slot] |
bool QLCDNumber::smallDecimalPoint | ( | ) | const |
bool QLCDNumber::smallDecimalPoint | ( | ) | const |
double QLCDNumber::value | ( | ) | const |
double QLCDNumber::value | ( | ) | const |
int QLCDNumber::intValue [read, write] |
the displayed value rounded to the nearest integer
This property corresponds to the nearest integer to the current value displayed by the LCDNumber. This is the value used for hexadecimal, octal and binary modes.
If the displayed value is not a number, the property has a value of 0.
Mode QLCDNumber::mode [read, write] |
the current display mode (number base)
Corresponds to the current display mode, which is one of BIN
, OCT
, DEC
(the default) and HEX
. DEC
mode can display floating point values, the other modes display the integer equivalent.
int QLCDNumber::numDigits [inline, read, write] |
the current number of digits displayed
Corresponds to the current number of digits. If QLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies one digit position.
SegmentStyle QLCDNumber::segmentStyle [read, write] |
the style of the LCDNumber
Style Result Outline
Produces raised segments filled with the background color (this is the default). Filled
Produces raised segments filled with the foreground color. Flat
Produces flat segments filled with the foreground color.
Outline
and Filled
will additionally use QColorGroup::light() and QColorGroup::dark() for shadow effects.
bool QLCDNumber::smallDecimalPoint [inline, read, write] |
the style of the decimal point
If TRUE the decimal point is drawn between two digit positions. Otherwise it occupies a digit position of its own, i.e. is drawn in a digit position. The default is FALSE.
The inter-digit space is made slightly wider when the decimal point is drawn between the digits.
double QLCDNumber::value [read, write] |
the displayed value
This property corresponds to the current value displayed by the LCDNumber.
If the displayed value is not a number, the property has a value of 0.