Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QLabel

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget
                      com.trolltech.qt.gui.QFrame
                          com.trolltech.qt.gui.QLabel

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QLabel

extends QFrame

The `QLabel` widget provides a text or image display. `QLabel` 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 mnemonic key for another widget.

A `QLabel` can contain any of the following content types:

Content | Setting
--- | ---
Plain text | Pass a QString to `setText()`.
Rich text | Pass a QString that contains rich text to `setText()`.
A pixmap | Pass a `QPixmap` to `setPixmap()`.
A movie | Pass a `QMovie` to `setMovie()`.
A number | Pass an int or a double to `setNum()`, which converts the number to plain text.
Nothing | The same as an empty plain text. This is the default. Set by `clear()`.

When the content is changed using any of these functions, any previous content is cleared.

The look of a `QLabel` can be tuned in several ways. All the settings of `QFrame` are available for specifying a widget frame. The positioning of the content within the `QLabel` widget area can be tuned with `setAlignment()` and `setIndent()`. Text content can also wrap lines along word bounderies with `setWordWrap()`. 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):

        QLabel label = new QLabel();
        label.setFrameStyle(QFrame.Shadow.Sunken.value() | QFrame.Shape.Panel.value() );
        label.setText("first line\nsecond line");
        label.setAlignment(Qt.AlignmentFlag.AlignBottom, Qt.AlignmentFlag.AlignRight);

A `QLabel` is often used as a label for an interactive widget. For this use `QLabel` provides a useful mechanism for adding an mnemonic (see `QKeySequence`) that will set the keyboard focus to the other widget (called the `QLabel`'s "buddy"). For example:

        QLineEdit phoneEdit = new QLineEdit();
        QLabel phoneLabel = new QLabel("Phone:");
        phoneLabel.setBuddy(phoneEdit);

In this example, keyboard focus is transferred to the label's buddy (the `QLineEdit`) when the user presses Alt+P. If the buddy was a button (inheriting from `QAbstractButton`), triggering the mnemonic would emulate a button click.

| A label shown in the Macintosh widget style.
| A label shown in the Plastique widget style.
| A label shown in the Windows XP widget style.

See also:
  `QLineEdit`, `QTextEdit`, `QPixmap`, `QMovie`, and GUI Design Handbook: Label.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame
`QFrame.Shadow, QFrame.Shape, QFrame.StyleMask`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Field Summary
`QSignalEmitter.Signal1` | `linkActivated` This signal is emitted when the user clicks a link.
`QSignalEmitter.Signal1` | `linkHovered` This signal is emitted when the user hovers over a link.

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Constructor Summary
`QLabel()` Constructs an empty label.
`QLabel(QWidget parent)` Constructs an empty label.
`QLabel(QWidget parent, Qt.WindowFlags f)` Constructs an empty label.
`QLabel(QWidget parent, Qt.WindowType[] f)` Constructs an empty label.
`QLabel(java.lang.String text)` Constructs a label that displays the text, `text`.
`QLabel(java.lang.String text, QWidget parent)` Constructs a label that displays the text, `text`.
`QLabel(java.lang.String text, QWidget parent, Qt.WindowFlags f)` Constructs a label that displays the text, `text`.
`QLabel(java.lang.String text, QWidget parent, Qt.WindowType[] f)` Constructs a label that displays the text, `text`.

Method Summary
`Qt.Alignment` | `alignment()` This property holds the alignment of the label's contents.
`QWidget` | `buddy()` Returns this label's buddy, or 0 if no buddy is currently set.
`void` | `clear()` Clears any label contents.
`static QLabel` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QLabel instance pointed to by `nativePointer`.
`boolean` | `hasScaledContents()` This property holds whether the label will scale its contents to fill all available space.
`int` | `indent()` This property holds the label's text indent in pixels.
`int` | `margin()` This property holds the width of the margin.
`QMovie` | `movie()` Returns a pointer to the label's movie, or 0 if no movie has been set.
`boolean` | `openExternalLinks()` Specifies whether `QLabel` should automatically open links using `QDesktopServices::openUrl()` instead of emitting the `linkActivated()` signal.
`QPicture` | `picture()` Returns the label's picture or null if the label doesn't have a picture.
`QPixmap` | `pixmap()` Returns the label's pixmap or null if the label doesn't have a picture.
`void` | `setAlignment(Qt.Alignment arg__1)` This property holds the alignment of the label's contents.
`void` | `setAlignment(Qt.AlignmentFlag[] arg__1)` This property holds the alignment of the label's contents.
`void` | `setBuddy(QWidget arg__1)` Sets this label's buddy to `buddy`.
`void` | `setIndent(int arg__1)` This property holds the label's text indent in pixels.
`void` | `setMargin(int arg__1)` This property holds the width of the margin.
`void` | `setMovie(QMovie movie)` Sets the label contents to `movie`.
`void` | `setNum(double arg__1)` Sets the label contents to plain text containing the textual representation of double `num`.
`void` | `setNum(int arg__1)` Sets the label contents to plain text containing the textual representation of integer `num`.
`void` | `setOpenExternalLinks(boolean open)` Specifies whether `QLabel` should automatically open links using `QDesktopServices::openUrl()` instead of emitting the `linkActivated()` signal.
`void` | `setPicture(QPicture arg__1)` Sets the label contents to `picture`.
`void` | `setPixmap(QPixmap arg__1)` This property holds the label's pixmap.
`void` | `setScaledContents(boolean arg__1)` This property holds whether the label will scale its contents to fill all available space.
`void` | `setText(java.lang.String arg__1)` This property holds the label's text.
`void` | `setTextFormat(Qt.TextFormat arg__1)` This property holds the label's text format.
`void` | `setTextInteractionFlags(Qt.TextInteractionFlag[] flags)` Specifies how the label should interact with user input if it displays text.
`void` | `setTextInteractionFlags(Qt.TextInteractionFlags flags)` Specifies how the label should interact with user input if it displays text.
`void` | `setWordWrap(boolean on)` This property holds the label's word-wrapping policy.
`java.lang.String` | `text()` This property holds the label's text.
`Qt.TextFormat` | `textFormat()` This property holds the label's text format.
`Qt.TextInteractionFlags` | `textInteractionFlags()` Specifies how the label should interact with user input if it displays text.
`boolean` | `wordWrap()` This property holds the label's word-wrapping policy.

Methods inherited from class com.trolltech.qt.gui.QFrame
`frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth`

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### linkActivated

    public final QSignalEmitter.Signal1 linkActivated

  This signal is emitted when the user clicks a link. The URL referred to by the anchor is passed in `link`.

See also:
  `linkHovered()` .

### linkHovered

    public final QSignalEmitter.Signal1 linkHovered

  This signal is emitted when the user hovers over a link. The URL referred to by the anchor is passed in `link`.

See also:
  `linkActivated()` .

Constructor Detail

### QLabel

    public QLabel(QWidget parent,
                  Qt.WindowType[] f)

  Constructs an empty label.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(QWidget parent)

  Constructs an empty label.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel()

  Constructs an empty label.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(QWidget parent,
                  Qt.WindowFlags f)

  Constructs an empty label.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(java.lang.String text,
                  QWidget parent,
                  Qt.WindowType[] f)

  Constructs a label that displays the text, `text`.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setText()`, `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(java.lang.String text,
                  QWidget parent)

  Constructs a label that displays the text, `text`.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setText()`, `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(java.lang.String text)

  Constructs a label that displays the text, `text`.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setText()`, `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

### QLabel

    public QLabel(java.lang.String text,
                  QWidget parent,
                  Qt.WindowFlags f)

  Constructs a label that displays the text, `text`.

  The `parent` and widget flag `f`, arguments are passed to the `QFrame` constructor.

See also:
  `setText()`, `setAlignment()`, `setFrameStyle()`, and `setIndent()`.

Method Detail

### alignment

    public final Qt.Alignment alignment()

  This property holds the alignment of the label's contents.

See also:
  `text`.

### buddy

    public final QWidget buddy()

  Returns this label's buddy, or 0 if no buddy is currently set.

See also:
  `setBuddy()`.

### clear

    public final void clear()

  Clears any label contents.

### hasScaledContents

    public final boolean hasScaledContents()

  This property holds whether the label will scale its contents to fill all available space. When enabled and the label shows a pixmap, it will scale the pixmap to fill the available space.

  This property's default is false.

### indent

    public final int indent()

  This property holds the label's text indent in pixels. If a label displays text, the indent applies to the left edge if `alignment()` is `Qt::AlignLeft` , to the right edge if `alignment()` is `Qt::AlignRight` , to the top edge if `alignment()` is `Qt::AlignTop` , and to to the bottom edge if `alignment()` is `Qt::AlignBottom` .

  If indent is negative, or if no indent has been set, the label computes the effective indent as follows: If frameWidth() 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 font().

See also:
  `alignment`, `margin`, frameWidth(), and font().

### margin

    public final int margin()

  This property holds the width of the margin. The margin is the distance between the innermost pixel of the frame and the outermost pixel of contents.

  The default margin is 0.

See also:
  `indent`.

### movie

    public final QMovie movie()

  Returns a pointer to the label's movie, or 0 if no movie has been set.

See also:
  `setMovie()`.

### openExternalLinks

    public final boolean openExternalLinks()

  Specifies whether `QLabel` should automatically open links using `QDesktopServices::openUrl()` instead of emitting the `linkActivated()` signal.

  Note: The `textInteractionFlags` set on the label need to include either `LinksAccessibleByMouse` or `LinksAccessibleByKeyboard`.

  The default value is false.

See also:
  `textInteractionFlags()`.

### setAlignment

    public final void setAlignment(Qt.AlignmentFlag[] arg__1)

  This property holds the alignment of the label's contents.

See also:
  `text`.

### setAlignment

    public final void setAlignment(Qt.Alignment arg__1)

  This property holds the alignment of the label's contents.

See also:
  `text`.

### setBuddy

    public final void setBuddy(QWidget arg__1)

  Sets this label's buddy to `buddy`.

  When the user presses the shortcut key indicated by this label, the keyboard focus is transferred to the label's buddy widget.

  The buddy mechanism is only available for `QLabels` that contain text in which one character is prefixed with an ampersand, '&'. This character is set as the shortcut key. See the `QKeySequence::mnemonic` documentation for details (to display an actual ampersand, use '&&').

  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:

          QLineEdit nameEd  = new QLineEdit();
          QLabel    nameLb  = new QLabel("Name:");
          nameLb.setBuddy(nameEd);
          QLineEdit phoneEd = new QLineEdit();
          QLabel    phoneLb = new QLabel("Phone:");
          phoneLb.setBuddy(phoneEd);
          // (layout setup not shown)

  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.

  To unset a previously set buddy, call this function with `buddy` set to 0.

See also:
  `buddy()`, `setText()`, `QShortcut`, and `setAlignment()`.

### setIndent

    public final void setIndent(int arg__1)

  This property holds the label's text indent in pixels. If a label displays text, the indent applies to the left edge if `alignment()` is `Qt::AlignLeft` , to the right edge if `alignment()` is `Qt::AlignRight` , to the top edge if `alignment()` is `Qt::AlignTop` , and to to the bottom edge if `alignment()` is `Qt::AlignBottom` .

  If indent is negative, or if no indent has been set, the label computes the effective indent as follows: If frameWidth() 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 font().

See also:
  `alignment`, `margin`, frameWidth(), and font().

### setMargin

    public final void setMargin(int arg__1)

  This property holds the width of the margin. The margin is the distance between the innermost pixel of the frame and the outermost pixel of contents.

  The default margin is 0.

See also:
  `indent`.

### setMovie

    public final void setMovie(QMovie movie)

  Sets the label contents to `movie`. Any previous content is cleared. The label does NOT take ownership of the movie.

  The buddy shortcut, if any, is disabled.

See also:
  `movie()`, and `setBuddy()`.

### setNum

    public final void setNum(double arg__1)

  Sets the label contents to plain text containing the textual representation of double `num`. Any previous content is cleared. Does nothing if the double's string representation is the same as the current contents of the label.

  The buddy shortcut, if any, is disabled.

See also:
  `setText()`, QString::setNum(), and `setBuddy()`.

### setNum

    public final void setNum(int arg__1)

  Sets the label contents to plain text containing the textual representation of integer `num`. Any previous content is cleared. Does nothing if the integer's string representation is the same as the current contents of the label.

  The buddy shortcut, if any, is disabled.

See also:
  `setText()`, QString::setNum(), and `setBuddy()`.

### setOpenExternalLinks

    public final void setOpenExternalLinks(boolean open)

  Specifies whether `QLabel` should automatically open links using `QDesktopServices::openUrl()` instead of emitting the `linkActivated()` signal.

  Note: The `textInteractionFlags` set on the label need to include either `LinksAccessibleByMouse` or `LinksAccessibleByKeyboard`.

  The default value is false.

See also:
  `textInteractionFlags()`.

### setPicture

    public final void setPicture(QPicture arg__1)

  Sets the label contents to `picture`. Any previous content is cleared.

  The buddy shortcut, if any, is disabled.

See also:
  `picture()`, and `setBuddy()`.

### setPixmap

    public final void setPixmap(QPixmap arg__1)

  This property holds the label's pixmap. If no pixmap has been set this will return 0.

  Setting the pixmap clears any previous content. The buddy shortcut, if any, is disabled.

### setScaledContents

    public final void setScaledContents(boolean arg__1)

  This property holds whether the label will scale its contents to fill all available space. When enabled and the label shows a pixmap, it will scale the pixmap to fill the available space.

  This property's default is false.

### setText

    public final void setText(java.lang.String arg__1)

  This property holds the label's text. If no text has been set this will return an empty string. Setting the text clears any previous content.

  The text will be interpreted either as plain text or as rich text, depending on the text format setting; see `setTextFormat()`. The default setting is `Qt::AutoText` ; i.e. `QLabel` will try to auto-detect the format of the text set.

  If a buddy has been set, the buddy mnemonic key is updated from the new text.

  Note that `QLabel` is well-suited to display small rich text documents, such as 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 `QTextEdit` in read-only mode instead. `QTextEdit` can also provide a scroll bar when necessary.

  Note: This function enables mouse tracking if `text` contains rich text.

See also:
  `setTextFormat()`, `setBuddy()`, and `alignment`.

### setTextFormat

    public final void setTextFormat(Qt.TextFormat arg__1)

  This property holds the label's text format. See the `Qt::TextFormat` enum for an explanation of the possible options.

  The default format is `Qt::AutoText` .

See also:
  `text()`.

### setTextInteractionFlags

    public final void setTextInteractionFlags(Qt.TextInteractionFlag[] flags)

  Specifies how the label should interact with user input if it displays text.

  If the flags contain `Qt::LinksAccessibleByKeyboard` the focus policy is also automatically set to `Qt::StrongFocus` . If `Qt::TextSelectableByKeyboard` is set then the focus policy is set to `Qt::ClickFocus` .

  The default value is `Qt::LinksAccessibleByMouse` .

### setTextInteractionFlags

    public final void setTextInteractionFlags(Qt.TextInteractionFlags flags)

  Specifies how the label should interact with user input if it displays text.

  If the flags contain `Qt::LinksAccessibleByKeyboard` the focus policy is also automatically set to `Qt::StrongFocus` . If `Qt::TextSelectableByKeyboard` is set then the focus policy is set to `Qt::ClickFocus` .

  The default value is `Qt::LinksAccessibleByMouse` .

### setWordWrap

    public final void setWordWrap(boolean on)

  This property holds the label's word-wrapping policy. If this property is true then label text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all.

### text

    public final java.lang.String text()

  This property holds the label's text. If no text has been set this will return an empty string. Setting the text clears any previous content.

  The text will be interpreted either as plain text or as rich text, depending on the text format setting; see `setTextFormat()`. The default setting is `Qt::AutoText` ; i.e. `QLabel` will try to auto-detect the format of the text set.

  If a buddy has been set, the buddy mnemonic key is updated from the new text.

  Note that `QLabel` is well-suited to display small rich text documents, such as 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 `QTextEdit` in read-only mode instead. `QTextEdit` can also provide a scroll bar when necessary.

  Note: This function enables mouse tracking if `text` contains rich text.

See also:
  `setTextFormat()`, `setBuddy()`, and `alignment`.

### textFormat

    public final Qt.TextFormat textFormat()

  This property holds the label's text format. See the `Qt::TextFormat` enum for an explanation of the possible options.

  The default format is `Qt::AutoText` .

See also:
  `text()`.

### textInteractionFlags

    public final Qt.TextInteractionFlags textInteractionFlags()

  Specifies how the label should interact with user input if it displays text.

  If the flags contain `Qt::LinksAccessibleByKeyboard` the focus policy is also automatically set to `Qt::StrongFocus` . If `Qt::TextSelectableByKeyboard` is set then the focus policy is set to `Qt::ClickFocus` .

  The default value is `Qt::LinksAccessibleByMouse` .

### wordWrap

    public final boolean wordWrap()

  This property holds the label's word-wrapping policy. If this property is true then label text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all.

### fromNativePointer

    public static QLabel fromNativePointer(QNativePointer nativePointer)

  This method returns the QLabel instance pointed to by `nativePointer`.

### picture

    public final QPicture picture()

  Returns the label's picture or null if the label doesn't have a picture.

### pixmap

    public final QPixmap pixmap()

  Returns the label's pixmap or null if the label doesn't have a picture.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD