<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt - 3.3.8 - espenr - 2499/qt - x11 - free - 3.3.8/src/widgets/tqlabel.cpp:66 -->
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > TQLabel Class< / title >
< style type = "text/css" > < ! - -
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
-->< / style >
< / head >
< body >
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" >
< tr bgcolor = "#E5E5E5" >
< td valign = center >
< a href = "index.html" >
< font color = "#004faf" > Home< / font > < / a >
| < a href = "classes.html" >
< font color = "#004faf" > All Classes< / font > < / a >
| < a href = "mainclasses.html" >
< font color = "#004faf" > Main Classes< / font > < / a >
| < a href = "annotated.html" >
< font color = "#004faf" > Annotated< / font > < / a >
| < a href = "groups.html" >
< font color = "#004faf" > Grouped Classes< / font > < / a >
| < a href = "functions.html" >
< font color = "#004faf" > Functions< / font > < / a >
< / td >
< td align = "right" valign = "center" > < img src = "logo32.png" align = "right" width = "64" height = "32" border = "0" > < / td > < / tr > < / table > < h1 align = center > TQLabel Class Reference< / h1 >
< p > The TQLabel widget provides a text or image display.
< a href = "#details" > More...< / a >
< p > < tt > #include < < a href = "tqlabel-h.html" > tqlabel.h< / a > > < / tt >
< p > Inherits < a href = "tqframe.html" > TQFrame< / a > .
< p > < a href = "tqlabel-members.html" > List of all member functions.< / a >
< h2 > Public Members< / h2 >
< ul >
< li class = fn > < a href = "#TQLabel" > < b > TQLabel< / b > < / a > ( TQWidget * parent, const char * name = 0, WFlags f = 0 )< / li >
< li class = fn > < a href = "#TQLabel-2" > < b > TQLabel< / b > < / a > ( const TQString & text, TQWidget * parent, const char * name = 0, WFlags f = 0 )< / li >
< li class = fn > < a href = "#TQLabel-3" > < b > TQLabel< / b > < / a > ( TQWidget * buddy, const TQString & text, TQWidget * parent, const char * name = 0, WFlags f = 0 )< / li >
< li class = fn > < a href = "#~TQLabel" > < b > ~TQLabel< / b > < / a > ()< / li >
< li class = fn > TQString < a href = "#text" > < b > text< / b > < / a > () const< / li >
< li class = fn > TQPixmap * < a href = "#pixmap" > < b > pixmap< / b > < / a > () const< / li >
< li class = fn > TQPicture * < a href = "#picture" > < b > picture< / b > < / a > () const< / li >
< li class = fn > TQMovie * < a href = "#movie" > < b > movie< / b > < / a > () const< / li >
< li class = fn > TextFormat < a href = "#textFormat" > < b > textFormat< / b > < / a > () const< / li >
< li class = fn > void < a href = "#setTextFormat" > < b > setTextFormat< / b > < / a > ( TextFormat )< / li >
< li class = fn > int < a href = "#alignment" > < b > alignment< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setAlignment" > < b > setAlignment< / b > < / a > ( int )< / li >
< li class = fn > int < a href = "#indent" > < b > indent< / b > < / a > () const< / li >
< li class = fn > void < a href = "#setIndent" > < b > setIndent< / b > < / a > ( int )< / li >
< li class = fn > bool autoResize () const < em > (obsolete)< / em > < / li >
< li class = fn > virtual void setAutoResize ( bool enable ) < em > (obsolete)< / em > < / li >
< li class = fn > bool < a href = "#hasScaledContents" > < b > hasScaledContents< / b > < / a > () const< / li >
< li class = fn > void < a href = "#setScaledContents" > < b > setScaledContents< / b > < / a > ( bool )< / li >
< li class = fn > virtual void < a href = "#setBuddy" > < b > setBuddy< / b > < / a > ( TQWidget * buddy )< / li >
< li class = fn > TQWidget * < a href = "#buddy" > < b > buddy< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setFont" > < b > setFont< / b > < / a > ( const TQFont & f )< / li >
< / ul >
< h2 > Public Slots< / h2 >
< ul >
< li class = fn > virtual void < a href = "#setText" > < b > setText< / b > < / a > ( const TQString & )< / li >
< li class = fn > virtual void < a href = "#setPixmap" > < b > setPixmap< / b > < / a > ( const TQPixmap & )< / li >
< li class = fn > virtual void < a href = "#setPicture" > < b > setPicture< / b > < / a > ( const TQPicture & picture )< / li >
< li class = fn > virtual void < a href = "#setMovie" > < b > setMovie< / b > < / a > ( const TQMovie & movie )< / li >
< li class = fn > virtual void < a href = "#setNum" > < b > setNum< / b > < / a > ( int num )< / li >
< li class = fn > virtual void < a href = "#setNum-2" > < b > setNum< / b > < / a > ( double num )< / li >
< li class = fn > void < a href = "#clear" > < b > clear< / b > < / a > ()< / li >
< / ul >
< h2 > Properties< / h2 >
< ul >
< li class = fn > Alignment < a href = "#alignment-prop" > < b > alignment< / b > < / a > - the alignment of the label's contents< / li >
< li class = fn > BackgroundMode < a href = "#backgroundMode-prop" > < b > backgroundMode< / b > < / a > - the label's background mode < em > (read only)< / em > < / li >
< li class = fn > int < a href = "#indent-prop" > < b > indent< / b > < / a > - the label's text indent in pixels< / li >
< li class = fn > TQPixmap < a href = "#pixmap-prop" > < b > pixmap< / b > < / a > - the label's pixmap< / li >
< li class = fn > bool < a href = "#scaledContents-prop" > < b > scaledContents< / b > < / a > - whether the label will scale its contents to fill all available space< / li >
< li class = fn > TQString < a href = "#text-prop" > < b > text< / b > < / a > - the label's text< / li >
< li class = fn > TextFormat < a href = "#textFormat-prop" > < b > textFormat< / b > < / a > - the label's text format< / li >
< / ul >
< h2 > Protected Members< / h2 >
< ul >
< li class = fn > virtual void < a href = "#drawContents" > < b > drawContents< / b > < / a > ( TQPainter * p )< / li >
< / ul >
< hr > < a name = "details" > < / a > < h2 > Detailed Description< / h2 >
The TQLabel widget provides a text or image display.
< p >
< p > TQLabel is used for displaying text or an image. No user
interaction functionality is provided. The visual appearance of
the label can be configured in various ways, and it can be used
for specifying a focus accelerator key for another widget.
< p > A TQLabel can contain any of the following content types:
< center > < table cellpadding = "4" cellspacing = "2" border = "0" >
< tr bgcolor = "#a2c511" > < th valign = "top" > Content < th valign = "top" > Setting
< tr bgcolor = "#f0f0f0" > < td valign = "top" > Plain text
< td valign = "top" > Pass a < a href = "tqstring.html" > TQString< / a > to < a href = "#setText" > setText< / a > ().
< tr bgcolor = "#d0d0d0" > < td valign = "top" > Rich text
< td valign = "top" > Pass a TQString that contains rich text to setText().
< tr bgcolor = "#f0f0f0" > < td valign = "top" > A pixmap
< td valign = "top" > Pass a < a href = "tqpixmap.html" > TQPixmap< / a > to < a href = "#setPixmap" > setPixmap< / a > ().
< tr bgcolor = "#d0d0d0" > < td valign = "top" > A movie
< td valign = "top" > Pass a < a href = "tqmovie.html" > TQMovie< / a > to < a href = "#setMovie" > setMovie< / a > ().
< tr bgcolor = "#f0f0f0" > < td valign = "top" > A number
< td valign = "top" > Pass an < em > int< / em > or a < em > double< / em > to < a href = "#setNum" > setNum< / a > (), which converts
the number to plain text.
< tr bgcolor = "#d0d0d0" > < td valign = "top" > Nothing
< td valign = "top" > The same as an empty plain text. This is the default. Set
by < a href = "#clear" > clear< / a > ().
< / table > < / center >
< p > When the content is changed using any of these functions, any
previous content is cleared.
< p > The look of a TQLabel can be tuned in several ways. All the
settings of < a href = "tqframe.html" > TQFrame< / a > are available for specifying a widget frame.
The positioning of the content within the TQLabel widget area can
be tuned with < a href = "#setAlignment" > setAlignment< / a > () and < a href = "#setIndent" > setIndent< / a > (). For example, this
code sets up a sunken panel with a two-line text in the bottom
right corner (both lines being flush with the right side of the
label):
< pre >
TQLabel *label = new TQLabel( this );
label-> < a href = "tqframe.html#setFrameStyle" > setFrameStyle< / a > ( TQFrame::< a href = "tqframe.html#Shape-enum" > Panel< / a > | TQFrame::< a href = "tqframe.html#Shadow-enum" > Sunken< / a > );
label-> < a href = "#setText" > setText< / a > ( "first line\nsecond line" );
label-> < a href = "#setAlignment" > setAlignment< / a > ( AlignBottom | AlignRight );
< / pre >
< p > A TQLabel is often used as a label for an interactive widget. For
this use TQLabel provides a useful mechanism for adding an
accelerator key (see < a href = "tqaccel.html" > TQAccel< / a > ) that will set the < a href = "focus.html#keyboard-focus" > keyboard focus< / a > to
the other widget (called the TQLabel's "buddy"). For example:
< pre >
< a href = "tqlineedit.html" > TQLineEdit< / a > * phoneEdit = new < a href = "tqlineedit.html" > TQLineEdit< / a > ( this, "phoneEdit" );
TQLabel* phoneLabel = new TQLabel( phoneEdit, "& Phone:", this, "phoneLabel" );
< / pre >
< p > In this example, keyboard focus is transferred to the label's
buddy (the < a href = "tqlineedit.html" > TQLineEdit< / a > ) when the user presses Alt+P. You can
also use the < a href = "#setBuddy" > setBuddy< / a > () function to accomplish the same thing.
< p > < img src = tqlabel-m.png > < img src = tqlabel-w.png >
< p > < p > See also < a href = "tqlineedit.html" > TQLineEdit< / a > , < a href = "tqtextedit.html" > TQTextEdit< / a > , < a href = "tqpixmap.html" > TQPixmap< / a > , < a href = "tqmovie.html" > TQMovie< / a > , < a href = "guibooks.html#fowler" > GUI Design Handbook: Label< / a > , < a href = "basic.html" > Basic Widgets< / a > , and < a href = "text.html" > Text Related Classes< / a > .
< hr > < h2 > Member Function Documentation< / h2 >
< h3 class = fn > < a name = "TQLabel" > < / a > TQLabel::TQLabel ( < a href = "tqwidget.html" > TQWidget< / a > * parent, const char * name = 0, WFlags f = 0 )
< / h3 >
Constructs an empty label.
< p > The < em > parent< / em > , < em > name< / em > and < a href = "ntqt.html#WidgetFlags" > widget flag< / a > < em > f< / em > , arguments are passed
to the < a href = "tqframe.html" > TQFrame< / a > constructor.
< p > < p > See also < a href = "#alignment-prop" > alignment< / a > , < a href = "tqframe.html#setFrameStyle" > setFrameStyle< / a > (), and < a href = "#indent-prop" > indent< / a > .
< h3 class = fn > < a name = "TQLabel-2" > < / a > TQLabel::TQLabel ( const < a href = "tqstring.html" > TQString< / a > & text, < a href = "tqwidget.html" > TQWidget< / a > * parent, const char * name = 0, WFlags f = 0 )
< / h3 >
Constructs a label that displays the text, < em > text< / em > .
< p > The < em > parent< / em > , < em > name< / em > and < a href = "ntqt.html#WidgetFlags" > widget flag< / a > < em > f< / em > , arguments are passed
to the < a href = "tqframe.html" > TQFrame< / a > constructor.
< p > < p > See also < a href = "#text-prop" > text< / a > , < a href = "#alignment-prop" > alignment< / a > , < a href = "tqframe.html#setFrameStyle" > setFrameStyle< / a > (), and < a href = "#indent-prop" > indent< / a > .
< h3 class = fn > < a name = "TQLabel-3" > < / a > TQLabel::TQLabel ( < a href = "tqwidget.html" > TQWidget< / a > * buddy, const < a href = "tqstring.html" > TQString< / a > & text, < a href = "tqwidget.html" > TQWidget< / a > * parent, const char * name = 0, WFlags f = 0 )
< / h3 >
Constructs a label that displays the text < em > text< / em > . The label has a
buddy widget, < em > buddy< / em > .
< p > If the < em > text< / em > contains an underlined letter (a letter preceded by
an ampersand, & ), and the text is in plain text format, when the
user presses Alt+ the underlined letter, focus is passed to the
buddy widget.
< p > The < em > parent< / em > , < em > name< / em > and < a href = "ntqt.html#WidgetFlags" > widget flag< / a > , < em > f< / em > , arguments are passed
to the < a href = "tqframe.html" > TQFrame< / a > constructor.
< p > < p > See also < a href = "#text-prop" > text< / a > , < a href = "#setBuddy" > setBuddy< / a > (), < a href = "#alignment-prop" > alignment< / a > , < a href = "tqframe.html#setFrameStyle" > setFrameStyle< / a > (), and < a href = "#indent-prop" > indent< / a > .
< h3 class = fn > < a name = "~TQLabel" > < / a > TQLabel::~TQLabel ()
< / h3 >
Destroys the label.
< h3 class = fn > int < a name = "alignment" > < / a > TQLabel::alignment () const
< / h3 > < p > Returns the alignment of the label's contents.
See the < a href = "tqlabel.html#alignment-prop" > "alignment"< / a > property for details.
< h3 class = fn > bool < a name = "autoResize" > < / a > TQLabel::autoResize () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing
is disabled.
< p > Auto-resizing is disabled by default.
< p > < p > See also < a href = "#setAutoResize" > setAutoResize< / a > ().
< h3 class = fn > < a href = "tqwidget.html" > TQWidget< / a > * < a name = "buddy" > < / a > TQLabel::buddy () const
< / h3 >
Returns this label's buddy, or 0 if no buddy is currently set.
< p > < p > See also < a href = "#setBuddy" > setBuddy< / a > ().
< h3 class = fn > void < a name = "clear" > < / a > TQLabel::clear ()< tt > [slot]< / tt >
< / h3 >
Clears any label contents. Equivalent to < a href = "#setText" > setText< / a > ( "" ).
< h3 class = fn > void < a name = "drawContents" > < / a > TQLabel::drawContents ( < a href = "tqpainter.html" > TQPainter< / a > * p )< tt > [virtual protected]< / tt >
< / h3 >
Draws the label contents using the painter < em > p< / em > .
< p > Reimplemented from < a href = "tqframe.html#drawContents" > TQFrame< / a > .
< h3 class = fn > bool < a name = "hasScaledContents" > < / a > TQLabel::hasScaledContents () const
< / h3 > < p > Returns TRUE if the label will scale its contents to fill all available space; otherwise returns FALSE.
See the < a href = "tqlabel.html#scaledContents-prop" > "scaledContents"< / a > property for details.
< h3 class = fn > int < a name = "indent" > < / a > TQLabel::indent () const
< / h3 > < p > Returns the label's text indent in pixels.
See the < a href = "tqlabel.html#indent-prop" > "indent"< / a > property for details.
< h3 class = fn > < a href = "tqmovie.html" > TQMovie< / a > * < a name = "movie" > < / a > TQLabel::movie () const
< / h3 >
Returns a pointer to the label's movie, or 0 if no movie has been
set.
< p > < p > See also < a href = "#setMovie" > setMovie< / a > ().
< h3 class = fn > < a href = "tqpicture.html" > TQPicture< / a > * < a name = "picture" > < / a > TQLabel::picture () const
< / h3 >
< p > Returns the label's picture or 0 if the label doesn't have a
picture.
< h3 class = fn > < a href = "tqpixmap.html" > TQPixmap< / a > * < a name = "pixmap" > < / a > TQLabel::pixmap () const
< / h3 > < p > Returns the label's pixmap.
See the < a href = "tqlabel.html#pixmap-prop" > "pixmap"< / a > property for details.
< h3 class = fn > void < a name = "setAlignment" > < / a > TQLabel::setAlignment ( int )< tt > [virtual]< / tt >
< / h3 > < p > Sets the alignment of the label's contents.
See the < a href = "tqlabel.html#alignment-prop" > "alignment"< / a > property for details.
< h3 class = fn > void < a name = "setAutoResize" > < / a > TQLabel::setAutoResize ( bool enable )< tt > [virtual]< / tt >
< / h3 > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Enables auto-resizing if < em > enable< / em > is TRUE, or disables it if < em > enable< / em > is FALSE.
< p > When auto-resizing is enabled the label will resize itself to fit
the contents whenever the contents change. The top-left corner is
not moved. This is useful for TQLabel widgets that are not managed by
a < a href = "tqlayout.html" > TQLayout< / a > (e.g., top-level widgets).
< p > Auto-resizing is disabled by default.
< p > < p > See also < a href = "#autoResize" > autoResize< / a > (), < a href = "tqwidget.html#adjustSize" > adjustSize< / a > (), and < a href = "tqwidget.html#sizeHint-prop" > sizeHint< / a > .
< h3 class = fn > void < a name = "setBuddy" > < / a > TQLabel::setBuddy ( < a href = "tqwidget.html" > TQWidget< / a > * buddy )< tt > [virtual]< / tt >
< / h3 >
Sets this label's buddy to < em > buddy< / em > .
< p > When the user presses the accelerator key indicated by this label,
the < a href = "focus.html#keyboard-focus" > keyboard focus< / a > is transferred to the label's buddy widget.
< p > The buddy mechanism is only available for TQLabels that contain
plain text in which one letter is prefixed with an ampersand, & .
This letter is set as the accelerator key. The letter is displayed
underlined, and the '& ' is not displayed (i.e. the < a href = "ntqt.html#TextFlags-enum" > ShowPrefix< / a >
alignment flag is turned on; see < a href = "#setAlignment" > setAlignment< / a > ()).
< p > In a dialog, you might create two data entry widgets and a label
for each, and set up the geometry layout so each label is just to
the left of its data entry widget (its "buddy"), for example:
< pre >
< a href = "tqlineedit.html" > TQLineEdit< / a > *nameEd = new < a href = "tqlineedit.html" > TQLineEdit< / a > ( this );
TQLabel *nameLb = new TQLabel( "& Name:", this );
nameLb-> < a href = "#setBuddy" > setBuddy< / a > ( nameEd );
< a href = "tqlineedit.html" > TQLineEdit< / a > *phoneEd = new < a href = "tqlineedit.html" > TQLineEdit< / a > ( this );
TQLabel *phoneLb = new TQLabel( "& Phone:", this );
phoneLb-> < a href = "#setBuddy" > setBuddy< / a > ( phoneEd );
// ( layout setup not shown )
< / pre >
< p > With the code above, the focus jumps to the Name field when the
user presses Alt+N, and to the Phone field when the user presses
Alt+P.
< p > To unset a previously set buddy, call this function with < em > buddy< / em >
set to 0.
< p > < p > See also < a href = "#buddy" > buddy< / a > (), < a href = "#text-prop" > text< / a > , < a href = "tqaccel.html" > TQAccel< / a > , and < a href = "#alignment-prop" > alignment< / a > .
< p > Examples: < a href = "addressbook-example.html#x580" > addressbook/centralwidget.cpp< / a > , < a href = "tutorial2-09.html#x2642" > chart/optionsform.cpp< / a > , and < a href = "regexptester-example.html#x2482" > regexptester/regexptester.cpp< / a > .
< h3 class = fn > void < a name = "setFont" > < / a > TQLabel::setFont ( const < a href = "tqfont.html" > TQFont< / a > & f )< tt > [virtual]< / tt >
< / h3 >
Sets the font used on the TQLabel to font < em > f< / em > .
< p > Example: < a href = "menu-example.html#x1865" > menu/menu.cpp< / a > .
< p > Reimplemented from < a href = "tqwidget.html#setFont" > TQWidget< / a > .
< h3 class = fn > void < a name = "setIndent" > < / a > TQLabel::setIndent ( int )
< / h3 > < p > Sets the label's text indent in pixels.
See the < a href = "tqlabel.html#indent-prop" > "indent"< / a > property for details.
< h3 class = fn > void < a name = "setMovie" > < / a > TQLabel::setMovie ( const < a href = "tqmovie.html" > TQMovie< / a > & movie )< tt > [virtual slot]< / tt >
< / h3 >
Sets the label contents to < em > movie< / em > . Any previous content is
cleared.
< p > The buddy accelerator, if any, is disabled.
< p > The label resizes itself if auto-resizing is enabled.
< p > < p > See also < a href = "#movie" > movie< / a > () and < a href = "#setBuddy" > setBuddy< / a > ().
< h3 class = fn > void < a name = "setNum" > < / a > TQLabel::setNum ( int num )< tt > [virtual slot]< / tt >
< / h3 >
Sets the label contents to plain text containing the textual
representation of integer < em > num< / em > . Any previous content is cleared.
Does nothing if the integer's string representation is the same as
the current contents of the label.
< p > The buddy accelerator, if any, is disabled.
< p > The label resizes itself if auto-resizing is enabled.
< p > < p > See also < a href = "#text-prop" > text< / a > , < a href = "tqstring.html#setNum" > TQString::setNum< / a > (), and < a href = "#setBuddy" > setBuddy< / a > ().
< h3 class = fn > void < a name = "setNum-2" > < / a > TQLabel::setNum ( double num )< tt > [virtual slot]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the label contents to plain text containing the textual
representation of double < em > num< / em > . Any previous content is cleared.
Does nothing if the double's string representation is the same as
the current contents of the label.
< p > The buddy accelerator, if any, is disabled.
< p > The label resizes itself if auto-resizing is enabled.
< p > < p > See also < a href = "#text-prop" > text< / a > , < a href = "tqstring.html#setNum" > TQString::setNum< / a > (), and < a href = "#setBuddy" > setBuddy< / a > ().
< h3 class = fn > void < a name = "setPicture" > < / a > TQLabel::setPicture ( const < a href = "tqpicture.html" > TQPicture< / a > & picture )< tt > [virtual slot]< / tt >
< / h3 >
Sets the label contents to < em > picture< / em > . Any previous content is
cleared.
< p > The buddy accelerator, if any, is disabled.
< p > < p > See also < a href = "#picture" > picture< / a > () and < a href = "#setBuddy" > setBuddy< / a > ().
< h3 class = fn > void < a name = "setPixmap" > < / a > TQLabel::setPixmap ( const < a href = "tqpixmap.html" > TQPixmap< / a > & )< tt > [virtual slot]< / tt >
< / h3 > < p > Sets the label's pixmap.
See the < a href = "tqlabel.html#pixmap-prop" > "pixmap"< / a > property for details.
< h3 class = fn > void < a name = "setScaledContents" > < / a > TQLabel::setScaledContents ( bool )
< / h3 > < p > Sets whether the label will scale its contents to fill all available space.
See the < a href = "tqlabel.html#scaledContents-prop" > "scaledContents"< / a > property for details.
< h3 class = fn > void < a name = "setText" > < / a > TQLabel::setText ( const < a href = "tqstring.html" > TQString< / a > & )< tt > [virtual slot]< / tt >
< / h3 > < p > Sets the label's text.
See the < a href = "tqlabel.html#text-prop" > "text"< / a > property for details.
< h3 class = fn > void < a name = "setTextFormat" > < / a > TQLabel::setTextFormat ( < a href = "ntqt.html#TextFormat-enum" > TextFormat< / a > )
< / h3 > < p > Sets the label's text format.
See the < a href = "tqlabel.html#textFormat-prop" > "textFormat"< / a > property for details.
< h3 class = fn > < a href = "tqstring.html" > TQString< / a > < a name = "text" > < / a > TQLabel::text () const
< / h3 > < p > Returns the label's text.
See the < a href = "tqlabel.html#text-prop" > "text"< / a > property for details.
< h3 class = fn > < a href = "ntqt.html#TextFormat-enum" > TextFormat< / a > < a name = "textFormat" > < / a > TQLabel::textFormat () const
< / h3 > < p > Returns the label's text format.
See the < a href = "tqlabel.html#textFormat-prop" > "textFormat"< / a > property for details.
< hr > < h2 > Property Documentation< / h2 >
< h3 class = fn > Alignment < a name = "alignment-prop" > < / a > alignment< / h3 >
< p > This property holds the alignment of the label's contents.
< p > The alignment is a bitwise OR of < a href = "ntqt.html#AlignmentFlags-enum" > TQt::AlignmentFlags< / a > and < a href = "ntqt.html#TextFlags-enum" > TQt::TextFlags< / a > values. The < a href = "ntqt.html#TextFlags-enum" > ExpandTabs< / a > , < a href = "ntqt.html#TextFlags-enum" > SingleLine< / a > and < a href = "ntqt.html#TextFlags-enum" > ShowPrefix< / a > flags apply only if the label contains plain text;
otherwise they are ignored. The < a href = "ntqt.html#TextFlags-enum" > DontClip< / a > flag is always
ignored. < a href = "ntqt.html#TextFlags-enum" > WordBreak< / a > applies to both rich text and plain text
labels. The < a href = "ntqt.html#TextFlags-enum" > BreakAnywhere< / a > flag is not supported in TQLabel.
< p > If the label has a buddy, the < a href = "ntqt.html#TextFlags-enum" > ShowPrefix< / a > flag is forced to
TRUE.
< p > The default alignment is < tt > AlignAuto | AlignVCenter | ExpandTabs< / tt >
if the label doesn't have a buddy and < tt > AlignAuto | AlignVCenter | ExpandTabs | ShowPrefix< / tt > if the label has a buddy. If the label
contains rich text, additionally < a href = "ntqt.html#TextFlags-enum" > WordBreak< / a > is turned on.
< p > < p > See also < a href = "ntqt.html#AlignmentFlags-enum" > TQt::AlignmentFlags< / a > , < a href = "#setBuddy" > setBuddy< / a > (), and < a href = "#text-prop" > text< / a > .
< p > Set this property's value with < a href = "#setAlignment" > setAlignment< / a > () and get this property's value with < a href = "#alignment" > alignment< / a > ().
< h3 class = fn > < a href = "ntqt.html#BackgroundMode-enum" > BackgroundMode< / a > < a name = "backgroundMode-prop" > < / a > backgroundMode< / h3 >
< p > This property holds the label's background mode.
< p > Get this property with < a href = "tqwidget.html#backgroundMode" > backgroundMode< / a > ().
< p > < p > See also < a href = "tqwidget.html#backgroundMode-prop" > TQWidget::backgroundMode< / a > .
< p > < h3 class = fn > int < a name = "indent-prop" > < / a > indent< / h3 >
< p > This property holds the label's text indent in pixels.
< p > If a label displays text, the indent applies to the left edge if
< a href = "#alignment" > alignment< / a > () is < a href = "ntqt.html#AlignmentFlags-enum" > AlignLeft< / a > , to the right edge if alignment() is
< a href = "ntqt.html#AlignmentFlags-enum" > AlignRight< / a > , to the top edge if alignment() is < a href = "ntqt.html#AlignmentFlags-enum" > AlignTop< / a > , and
to to the bottom edge if alignment() is < a href = "ntqt.html#AlignmentFlags-enum" > AlignBottom< / a > .
< p > If indent is negative, or if no indent has been set, the label
computes the effective indent as follows: If < a href = "tqframe.html#frameWidth" > frameWidth< / a > () is 0,
the effective indent becomes 0. If frameWidth() is greater than 0,
the effective indent becomes half the width of the "x" character
of the widget's current < a href = "tqwidget.html#font" > font< / a > ().
< p > < p > See also < a href = "#alignment-prop" > alignment< / a > , < a href = "tqframe.html#frameWidth-prop" > frameWidth< / a > , and < a href = "tqwidget.html#font-prop" > font< / a > .
< p > Set this property's value with < a href = "#setIndent" > setIndent< / a > () and get this property's value with < a href = "#indent" > indent< / a > ().
< h3 class = fn > < a href = "tqpixmap.html" > TQPixmap< / a > < a name = "pixmap-prop" > < / a > pixmap< / h3 >
< p > This property holds the label's pixmap.
< p > If no pixmap has been set this will return an invalid pixmap.
< p > Setting the pixmap clears any previous content, and resizes the
label if < a href = "#autoResize" > TQLabel::autoResize< / a > () is TRUE. The buddy accelerator,
if any, is disabled.
< p > Set this property's value with < a href = "#setPixmap" > setPixmap< / a > () and get this property's value with < a href = "#pixmap" > pixmap< / a > ().
< h3 class = fn > bool < a name = "scaledContents-prop" > < / a > scaledContents< / h3 >
< p > This property holds whether the label will scale its contents to fill all available space.
< p > When enabled and the label shows a pixmap, it will scale the
pixmap to fill the available space.
< p > This property's default is FALSE.
< p > < p > See also < a href = "#scaledContents-prop" > scaledContents< / a > .
< p > Set this property's value with < a href = "#setScaledContents" > setScaledContents< / a > () and get this property's value with < a href = "#hasScaledContents" > hasScaledContents< / a > ().
< h3 class = fn > < a href = "tqstring.html" > TQString< / a > < a name = "text-prop" > < / a > text< / h3 >
< p > This property holds the label's text.
< p > If no text has been set this will return an empty string. Setting
the text clears any previous content, unless they are the same.
< p > The text will be interpreted either as a plain text or as a rich
text, depending on the text format setting; see < a href = "#setTextFormat" > setTextFormat< / a > ().
The default setting is < a href = "ntqt.html#TextFormat-enum" > AutoText< / a > , i.e. TQLabel will try to
auto-detect the format of the text set.
< p > If the text is interpreted as a plain text and a buddy has been
set, the buddy accelerator key is updated from the new text.
< p > The label resizes itself if auto-resizing is enabled.
< p > Note that TQLabel is well-suited to display small rich text
documents, i.e. those small documents that get their document
specific settings (font, text color, link color) from the label's
palette and font properties. For large documents, use < a href = "tqtextedit.html" > TQTextEdit< / a >
in read-only mode instead. TQTextEdit will flicker less on resize
and can also provide a scrollbar when necessary.
< p > < p > See also < a href = "#textFormat-prop" > textFormat< / a > , < a href = "#setBuddy" > setBuddy< / a > (), and < a href = "#alignment-prop" > alignment< / a > .
< p > Set this property's value with < a href = "#setText" > setText< / a > () and get this property's value with < a href = "#text" > text< / a > ().
< h3 class = fn > < a href = "ntqt.html#TextFormat-enum" > TextFormat< / a > < a name = "textFormat-prop" > < / a > textFormat< / h3 >
< p > This property holds the label's text format.
< p > See the < a href = "ntqt.html#TextFormat-enum" > TQt::TextFormat< / a > enum for an explanation of the possible
options.
< p > The default format is < a href = "ntqt.html#TextFormat-enum" > AutoText< / a > .
< p > < p > See also < a href = "#text-prop" > text< / a > .
< p > Set this property's value with < a href = "#setTextFormat" > setTextFormat< / a > () and get this property's value with < a href = "#textFormat" > textFormat< / a > ().
<!-- eof -->
< hr > < p >
This file is part of the < a href = "index.html" > TQt toolkit< / a > .
Copyright © 1995-2007
< a href = "http://www.trolltech.com/" > Trolltech< / a > . All Rights Reserved.< p > < address > < hr > < div align = center >
< table width = 100% cellspacing = 0 border = 0 > < tr >
< td > Copyright © 2007
< a href = "troll.html" > Trolltech< / a > < td align = center > < a href = "trademarks.html" > Trademarks< / a >
< td align = right > < div align = right > TQt 3.3.8< / div >
< / table > < / div > < / address > < / body >
< / html >