The QLabel widget displays a static text or pixmap. More...
#include <qlabel.h>
Inherits QFrame.
A label is a text or pixmap field that can have an optional frame (since QLabel inherits QFrame).
The contents of a label can be specified as a normal text, as a numeric value (which is internally converted to a text) or, as a pixmap.
A label can be aligned in many different ways. The alignment setting specifies where to position the contents relative to the frame rectangle. See setAlignment() for a description of the alignment flags.
Enabling auto-resizing will make a label resize itself whenever the contents change. The top left corner is kept unchanged.
Example of use:
QLabel *label = new QLabel; label->setFrameStyle( QFrame::Panel | QFrame::Sunken ); label->setText( "first line\nsecond line" ); label->setAlignment( AlignBottom | AlignRight );
Examples: tictac/tictac.cpp forever/forever.cpp menu/menu.cpp qmag/qmag.cpp cursor/cursor.cpp widgets/widgets.cpp
Constructs an empty label which is left-aligned, vertically centered, has an automatic margin and with manual resizing.
The parent, name and f arguments are passed to the QFrame constructor.
See also: setAlignment(), setFrameStyle(), setMargin() and setAutoResize().
Constructs a label with a text. The label is left-aligned, vertically centered, has an automatic margin and with manual resizing.
The parent, name and f arguments are passed to the QFrame constructor.
See also: setAlignment(), setFrameStyle(), setMargin() and setAutoResize().
Destroys the label.
Returns the alignment setting.
The default alignment is AlignLeft | AlignVCenter | ExpandTabs
.
See also: setAlignment().
Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is disabled.
Auto-resizing is disabled by default.
See also: setAutoResize().
[virtual protected]
Draws the label contents using the painter p.
Reimplemented from QFrame.
Returns the margin of the label.
See also: setMargin().
Returns the label pixmap.
See also: setPixmap().
Sets the alignment of the label contents and redraws itself.
The alignment is the bitwise OR of the following flags:
AlignLeft
aligns to the left border.
AlignRight
aligns to the right border.
AlignHCenter
aligns horizontally centered.
AlignTop
aligns to the top border.
AlignBottom
aligns to the bottom border.
AlignVCenter
aligns vertically centered
AlignCenter
(= AlignHCenter
| AlignVCenter)
ExpandTabs
expands tabulators.
WordBreak
enables automatic word breaking.
See also: alignment().
Examples: qmag/qmag.cpp cursor/cursor.cpp widgets/widgets.cpp
Enables auto-resizing if enable is TRUE, or disables it if enable is FALSE.
When auto-resizing is enabled, the label will resize itself whenever the contents change. The top left corner is not moved.
See also: autoResize() and adjustSize().
Examples: forever/forever.cpp
Sets the margin of the label to margin pixels.
The margin applies to the left edge if alignment() is AlignLeft,
to the right edge if alignment() is AlignRight,
to the top edge
if alignment() is AlignTop,
and to to the bottom edge if
alignment() is AlignBottom.
If margin is negative (as it is by default), the label computes the margin as follows: If the frame width is zero, the effective margin becomes 0. If the frame style is greater than zero, the effective margin becomes half the width of the "x" character (of the widget's current font.
Setting a non-negative margin gives the specified margin in pixels.
See also: margin(), frameWidth() and font().
[slot]
Sets the label contents to num (converts it to text) and redraws the contents.
The label resizes itself if auto-resizing is enabled.
See also: setAutoResize().
[slot]
Sets the label contents to num (converts it to text) and redraws the contents.
The label resizes itself if auto-resizing is enabled. Nothing happens if num reads the same as the current label.
See also: setAutoResize().
[slot]
Sets the label contents to pixmap and redraws the contents.
The label resizes itself if auto-resizing is enabled. Nothing happens if pixmap is the same as the current label.
See also: pixmap(), setText() and setAutoResize().
[slot]
Sets the label contents to text and redraws the contents.
The label resizes itself if auto-resizing is enabled. Nothing happens if text is the same as the current label.
See also: text(), setPixmap() and setAutoResize().
Examples: forever/forever.cpp qmag/qmag.cpp cursor/cursor.cpp widgets/widgets.cpp
[virtual]
Returns a size which fits the contents of the label.
Bugs and limitations:
Reimplemented from QWidget.
Returns the label text.
See also: setText().
This file is part of the Qt toolkit, copyright © 1995-96 Troll Tech, all rights reserved.
It was generated from the following files: