[][src]Struct qt_widgets::QLabel

#[repr(C)]
pub struct QLabel { /* fields omitted */ }

The QLabel widget provides a text or image display.

C++ class: QLabel.

C++ documentation:

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:

ContentSetting
Plain textPass a QString to setText().
Rich textPass a QString that contains rich text to setText().
A pixmapPass a QPixmap to setPixmap().
A moviePass a QMovie to setMovie().
A numberPass an int or a double to setNum(), which converts the number to plain text.
NothingThe same as an empty plain text. This is the default. Set by clear().

Warning: When passing a QString to the constructor or calling setText(), make sure to sanitize your input, as QLabel tries to guess whether it displays the text as plain text or as rich text, a subset of HTML 4 markup. You may want to call setTextFormat() explicitly, e.g. in case you expect the text to be in plain format but cannot control the text source (for instance when displaying data loaded from the Web).

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

By default, labels display left-aligned, vertically-centered text and images, where any tabs in the text to be displayed are automatically expanded. However, the look of a QLabel can be adjusted and fine-tuned in several ways.

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 boundaries 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(this); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); label->setText("first line\nsecond line"); label->setAlignment(Qt::AlignBottom | Qt::AlignRight);

The properties and functions QLabel inherits from QFrame can also be used to specify the widget frame to be used for any given label.

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(this); QLabel phoneLabel = new QLabel("&Phone:", this); 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.

Methods

impl QLabel[src]

pub fn slot_set_text(&self) -> Receiver<(*const QString,)>[src]

This property holds the label's text

Returns a built-in Qt slot QLabel::setText that can be passed to qt_core::Signal::connect.

C++ documentation:

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. See Supported HTML Subset for the definition of rich text.

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.

Access functions:

QString text() const
void setText(const QString &)

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

pub fn slot_set_pixmap(&self) -> Receiver<(*const QPixmap,)>[src]

This property holds the label's pixmap

Returns a built-in Qt slot QLabel::setPixmap that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

Access functions:

const QPixmap *pixmap() const
void setPixmap(const QPixmap &)

pub fn slot_set_picture(&self) -> Receiver<(*const QPicture,)>[src]

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

Returns a built-in Qt slot QLabel::setPicture that can be passed to qt_core::Signal::connect.

C++ documentation:

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

The buddy shortcut, if any, is disabled.

See also picture() and setBuddy().

pub fn slot_set_movie(&self) -> Receiver<(*mut QMovie,)>[src]

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

Returns a built-in Qt slot QLabel::setMovie that can be passed to qt_core::Signal::connect.

C++ documentation:

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().

pub fn slot_set_num(&self) -> Receiver<(c_int,)>[src]

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.

Returns a built-in Qt slot QLabel::setNum that can be passed to qt_core::Signal::connect.

C++ documentation:

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().

pub fn slot_set_num2(&self) -> Receiver<(c_double,)>[src]

This is an overloaded function.

Returns a built-in Qt slot QLabel::setNum that can be passed to qt_core::Signal::connect.

C++ documentation:

This is an overloaded function.

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().

pub fn slot_clear(&self) -> Receiver<()>[src]

Clears any label contents.

Returns a built-in Qt slot QLabel::clear that can be passed to qt_core::Signal::connect.

C++ documentation:

Clears any label contents.

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

Returns a built-in Qt signal QLabel::linkActivated that can be passed to qt_core::Signal::connect.

C++ documentation:

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

This function was introduced in Qt 4.2.

See also linkHovered().

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

Returns a built-in Qt signal QLabel::linkHovered that can be passed to qt_core::Signal::connect.

C++ documentation:

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

This function was introduced in Qt 4.2.

See also linkActivated().

pub unsafe fn alignment(&self) -> QFlags<AlignmentFlag>[src]

This property holds the alignment of the label's contents

Calls C++ function: QFlags<Qt::AlignmentFlag> QLabel::alignment() const.

C++ documentation:

This property holds the alignment of the label's contents

By default, the contents of the label are left-aligned and vertically-centered.

Access functions:

Qt::Alignment alignment() const
void setAlignment(Qt::Alignment)

See also text.

pub unsafe fn buddy(&self) -> MutPtr<QWidget>[src]

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

Calls C++ function: QWidget* QLabel::buddy() const.

C++ documentation:

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

See also setBuddy().

pub unsafe fn clear(&mut self)[src]

Clears any label contents.

Calls C++ function: [slot] void QLabel::clear().

C++ documentation:

Clears any label contents.

pub unsafe fn has_scaled_contents(&self) -> bool[src]

This property holds whether the label will scale its contents to fill all available space.

Calls C++ function: bool QLabel::hasScaledContents() const.

C++ documentation:

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.

Access functions:

bool hasScaledContents() const
void setScaledContents(bool)

pub unsafe fn has_selected_text(&self) -> bool[src]

This property holds whether there is any text selected

Calls C++ function: bool QLabel::hasSelectedText() const.

C++ documentation:

This property holds whether there is any text selected

hasSelectedText() returns true if some or all of the text has been selected by the user; otherwise returns false.

By default, this property is false.

Note: The textInteractionFlags set on the label need to include either TextSelectableByMouse or TextSelectableByKeyboard.

This property was introduced in Qt 4.7.

Access functions:

bool hasSelectedText() const

See also selectedText().

pub unsafe fn height_for_width(&self, arg1: c_int) -> c_int[src]

Reimplemented from QWidget::heightForWidth().

Calls C++ function: virtual int QLabel::heightForWidth(int arg1) const.

C++ documentation:

Reimplemented from QWidget::heightForWidth().

pub unsafe fn indent(&self) -> c_int[src]

This property holds the label's text indent in pixels

Calls C++ function: int QLabel::indent() const.

C++ documentation:

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 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().

By default, the indent is -1, meaning that an effective indent is calculating in the manner described above.

Access functions:

int indent() const
void setIndent(int)

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

pub unsafe fn margin(&self) -> c_int[src]

This property holds the width of the margin

Calls C++ function: int QLabel::margin() const.

C++ documentation:

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.

Access functions:

int margin() const
void setMargin(int)

See also indent.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QLabel::metaObject() const.

pub unsafe fn minimum_size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QWidget::minimumSizeHint().

Calls C++ function: virtual QSize QLabel::minimumSizeHint() const.

C++ documentation:

Reimplemented from QWidget::minimumSizeHint().

pub unsafe fn movie(&self) -> MutPtr<QMovie>[src]

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

Calls C++ function: QMovie* QLabel::movie() const.

C++ documentation:

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

See also setMovie().

pub unsafe fn from_q_widget_q_flags_window_type(
    parent: impl CastInto<MutPtr<QWidget>>,
    f: QFlags<WindowType>
) -> CppBox<QLabel>
[src]

Constructs an empty label.

Calls C++ function: [constructor] void QLabel::QLabel(QWidget* parent = …, QFlags<Qt::WindowType> f = …).

C++ documentation:

Constructs an empty label.

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

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

pub unsafe fn from_q_string_q_widget_q_flags_window_type(
    text: impl CastInto<Ref<QString>>,
    parent: impl CastInto<MutPtr<QWidget>>,
    f: QFlags<WindowType>
) -> CppBox<QLabel>
[src]

Constructs a label that displays the text, text.

Calls C++ function: [constructor] void QLabel::QLabel(const QString& text, QWidget* parent = …, QFlags<Qt::WindowType> f = …).

C++ documentation:

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().

pub unsafe fn new() -> CppBox<QLabel>[src]

The QLabel widget provides a text or image display.

Calls C++ function: [constructor] void QLabel::QLabel().

C++ documentation:

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:

ContentSetting
Plain textPass a QString to setText().
Rich textPass a QString that contains rich text to setText().
A pixmapPass a QPixmap to setPixmap().
A moviePass a QMovie to setMovie().
A numberPass an int or a double to setNum(), which converts the number to plain text.
NothingThe same as an empty plain text. This is the default. Set by clear().

Warning: When passing a QString to the constructor or calling setText(), make sure to sanitize your input, as QLabel tries to guess whether it displays the text as plain text or as rich text, a subset of HTML 4 markup. You may want to call setTextFormat() explicitly, e.g. in case you expect the text to be in plain format but cannot control the text source (for instance when displaying data loaded from the Web).

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

By default, labels display left-aligned, vertically-centered text and images, where any tabs in the text to be displayed are automatically expanded. However, the look of a QLabel can be adjusted and fine-tuned in several ways.

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 boundaries 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(this); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); label->setText("first line\nsecond line"); label->setAlignment(Qt::AlignBottom | Qt::AlignRight);

The properties and functions QLabel inherits from QFrame can also be used to specify the widget frame to be used for any given label.

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(this); QLabel phoneLabel = new QLabel("&Phone:", this); 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.

pub unsafe fn from_q_widget(
    parent: impl CastInto<MutPtr<QWidget>>
) -> CppBox<QLabel>
[src]

Constructs an empty label.

Calls C++ function: [constructor] void QLabel::QLabel(QWidget* parent = …).

C++ documentation:

Constructs an empty label.

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

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

pub unsafe fn from_q_string_q_widget(
    text: impl CastInto<Ref<QString>>,
    parent: impl CastInto<MutPtr<QWidget>>
) -> CppBox<QLabel>
[src]

Constructs a label that displays the text, text.

Calls C++ function: [constructor] void QLabel::QLabel(const QString& text, QWidget* parent = …).

C++ documentation:

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().

pub unsafe fn from_q_string(text: impl CastInto<Ref<QString>>) -> CppBox<QLabel>[src]

Constructs a label that displays the text, text.

Calls C++ function: [constructor] void QLabel::QLabel(const QString& text).

C++ documentation:

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().

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

Calls C++ function: bool QLabel::openExternalLinks() const.

C++ documentation:

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.

This property was introduced in Qt 4.2.

Access functions:

bool openExternalLinks() const
void setOpenExternalLinks(bool open)

See also textInteractionFlags().

pub unsafe fn picture(&self) -> Ptr<QPicture>[src]

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

Calls C++ function: const QPicture* QLabel::picture() const.

C++ documentation:

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

See also setPicture().

pub unsafe fn pixmap(&self) -> Ptr<QPixmap>[src]

This property holds the label's pixmap

Calls C++ function: const QPixmap* QLabel::pixmap() const.

C++ documentation:

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.

Access functions:

const QPixmap *pixmap() const
void setPixmap(const QPixmap &)

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QLabel::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QLabel::qt_metacast(const char* arg1).

pub unsafe fn selected_text(&self) -> CppBox<QString>[src]

This property holds the selected text

Calls C++ function: QString QLabel::selectedText() const.

C++ documentation:

This property holds the selected text

If there is no selected text this property's value is an empty string.

By default, this property contains an empty string.

Note: The textInteractionFlags set on the label need to include either TextSelectableByMouse or TextSelectableByKeyboard.

This property was introduced in Qt 4.7.

Access functions:

QString selectedText() const

See also hasSelectedText().

pub unsafe fn selection_start(&self) -> c_int[src]

selectionStart() returns the index of the first selected character in the label or -1 if no text is selected.

Calls C++ function: int QLabel::selectionStart() const.

C++ documentation:

selectionStart() returns the index of the first selected character in the label or -1 if no text is selected.

Note: The textInteractionFlags set on the label need to include either TextSelectableByMouse or TextSelectableByKeyboard.

This function was introduced in Qt 4.7.

See also selectedText().

pub unsafe fn set_alignment(&mut self, arg1: QFlags<AlignmentFlag>)[src]

This property holds the alignment of the label's contents

Calls C++ function: void QLabel::setAlignment(QFlags<Qt::AlignmentFlag> arg1).

C++ documentation:

This property holds the alignment of the label's contents

By default, the contents of the label are left-aligned and vertically-centered.

Access functions:

Qt::Alignment alignment() const
void setAlignment(Qt::Alignment)

See also text.

pub unsafe fn set_buddy(&mut self, arg1: impl CastInto<MutPtr<QWidget>>)[src]

Sets this label's buddy to buddy.

Calls C++ function: void QLabel::setBuddy(QWidget* arg1).

C++ documentation:

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 nameEdit = new QLineEdit(this); QLabel nameLabel = new QLabel("&Name:", this); nameLabel->setBuddy(nameEdit); QLineEdit phoneEdit = new QLineEdit(this); QLabel phoneLabel = new QLabel("&Phone:", this); phoneLabel->setBuddy(phoneEdit); // (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().

pub unsafe fn set_indent(&mut self, arg1: c_int)[src]

This property holds the label's text indent in pixels

Calls C++ function: void QLabel::setIndent(int arg1).

C++ documentation:

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 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().

By default, the indent is -1, meaning that an effective indent is calculating in the manner described above.

Access functions:

int indent() const
void setIndent(int)

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

pub unsafe fn set_margin(&mut self, arg1: c_int)[src]

This property holds the width of the margin

Calls C++ function: void QLabel::setMargin(int arg1).

C++ documentation:

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.

Access functions:

int margin() const
void setMargin(int)

See also indent.

pub unsafe fn set_movie(&mut self, movie: impl CastInto<MutPtr<QMovie>>)[src]

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

Calls C++ function: [slot] void QLabel::setMovie(QMovie* movie).

C++ documentation:

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().

pub unsafe fn set_num_int(&mut self, arg1: c_int)[src]

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.

Calls C++ function: [slot] void QLabel::setNum(int arg1).

C++ documentation:

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().

pub unsafe fn set_num_double(&mut self, arg1: c_double)[src]

This is an overloaded function.

Calls C++ function: [slot] void QLabel::setNum(double arg1).

C++ documentation:

This is an overloaded function.

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().

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

Calls C++ function: void QLabel::setOpenExternalLinks(bool open).

C++ documentation:

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.

This property was introduced in Qt 4.2.

Access functions:

bool openExternalLinks() const
void setOpenExternalLinks(bool open)

See also textInteractionFlags().

pub unsafe fn set_picture(&mut self, arg1: impl CastInto<Ref<QPicture>>)[src]

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

Calls C++ function: [slot] void QLabel::setPicture(const QPicture& arg1).

C++ documentation:

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

The buddy shortcut, if any, is disabled.

See also picture() and setBuddy().

pub unsafe fn set_pixmap(&mut self, arg1: impl CastInto<Ref<QPixmap>>)[src]

This property holds the label's pixmap

Calls C++ function: [slot] void QLabel::setPixmap(const QPixmap& arg1).

C++ documentation:

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.

Access functions:

const QPixmap *pixmap() const
void setPixmap(const QPixmap &)

pub unsafe fn set_scaled_contents(&mut self, arg1: bool)[src]

This property holds whether the label will scale its contents to fill all available space.

Calls C++ function: void QLabel::setScaledContents(bool arg1).

C++ documentation:

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.

Access functions:

bool hasScaledContents() const
void setScaledContents(bool)

pub unsafe fn set_selection(&mut self, arg1: c_int, arg2: c_int)[src]

Selects text from position start and for length characters.

Calls C++ function: void QLabel::setSelection(int arg1, int arg2).

C++ documentation:

Selects text from position start and for length characters.

Note: The textInteractionFlags set on the label need to include either TextSelectableByMouse or TextSelectableByKeyboard.

This function was introduced in Qt 4.7.

See also selectedText().

pub unsafe fn set_text(&mut self, arg1: impl CastInto<Ref<QString>>)[src]

This property holds the label's text

Calls C++ function: [slot] void QLabel::setText(const QString& arg1).

C++ documentation:

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. See Supported HTML Subset for the definition of rich text.

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.

Access functions:

QString text() const
void setText(const QString &)

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

pub unsafe fn set_text_format(&mut self, arg1: TextFormat)[src]

This property holds the label's text format

Calls C++ function: void QLabel::setTextFormat(Qt::TextFormat arg1).

C++ documentation:

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.

Access functions:

Qt::TextFormat textFormat() const
void setTextFormat(Qt::TextFormat)

See also text().

pub unsafe fn set_text_interaction_flags(
    &mut self,
    flags: QFlags<TextInteractionFlag>
)
[src]

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

Calls C++ function: void QLabel::setTextInteractionFlags(QFlags<Qt::TextInteractionFlag> flags).

C++ documentation:

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.

This property was introduced in Qt 4.2.

Access functions:

Qt::TextInteractionFlags textInteractionFlags() const
void setTextInteractionFlags(Qt::TextInteractionFlags flags)

pub unsafe fn set_word_wrap(&mut self, on: bool)[src]

This property holds the label's word-wrapping policy

Calls C++ function: void QLabel::setWordWrap(bool on).

C++ documentation:

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.

By default, word wrap is disabled.

Access functions:

bool wordWrap() const
void setWordWrap(bool on)

See also text.

pub unsafe fn size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QWidget::sizeHint().

Calls C++ function: virtual QSize QLabel::sizeHint() const.

C++ documentation:

Reimplemented from QWidget::sizeHint().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn text(&self) -> CppBox<QString>[src]

This property holds the label's text

Calls C++ function: QString QLabel::text() const.

C++ documentation:

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. See Supported HTML Subset for the definition of rich text.

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.

Access functions:

QString text() const
void setText(const QString &)

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

pub unsafe fn text_format(&self) -> TextFormat[src]

This property holds the label's text format

Calls C++ function: Qt::TextFormat QLabel::textFormat() const.

C++ documentation:

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.

Access functions:

Qt::TextFormat textFormat() const
void setTextFormat(Qt::TextFormat)

See also text().

pub unsafe fn text_interaction_flags(&self) -> QFlags<TextInteractionFlag>[src]

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

Calls C++ function: QFlags<Qt::TextInteractionFlag> QLabel::textInteractionFlags() const.

C++ documentation:

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.

This property was introduced in Qt 4.2.

Access functions:

Qt::TextInteractionFlags textInteractionFlags() const
void setTextInteractionFlags(Qt::TextInteractionFlags flags)

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QLabel::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QLabel::trUtf8(const char* s, const char* c, int n).

pub unsafe fn word_wrap(&self) -> bool[src]

This property holds the label's word-wrapping policy

Calls C++ function: bool QLabel::wordWrap() const.

C++ documentation:

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.

By default, word wrap is disabled.

Access functions:

bool wordWrap() const
void setWordWrap(bool on)

See also text.

Methods from Deref<Target = QFrame>

pub unsafe fn frame_rect(&self) -> CppBox<QRect>[src]

This property holds the frame's rectangle

Calls C++ function: QRect QFrame::frameRect() const.

C++ documentation:

This property holds the frame's rectangle

The frame's rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting the rectangle does does not cause a widget update. The frame rectangle is automatically adjusted when the widget changes size.

If you set the rectangle to a null rectangle (for example, QRect(0, 0, 0, 0)), then the resulting frame rectangle is equivalent to the widget rectangle.

Access functions:

QRect frameRect() const
void setFrameRect(const QRect &)

pub unsafe fn frame_shadow(&self) -> Shadow[src]

This property holds the frame shadow value from the frame style

Calls C++ function: QFrame::Shadow QFrame::frameShadow() const.

C++ documentation:

This property holds the frame shadow value from the frame style

Access functions:

Shadow frameShadow() const
void setFrameShadow(Shadow)

See also frameStyle() and frameShape().

pub unsafe fn frame_shape(&self) -> Shape[src]

This property holds the frame shape value from the frame style

Calls C++ function: QFrame::Shape QFrame::frameShape() const.

C++ documentation:

This property holds the frame shape value from the frame style

Access functions:

Shape frameShape() const
void setFrameShape(Shape)

See also frameStyle() and frameShadow().

pub unsafe fn frame_style(&self) -> c_int[src]

Returns the frame style.

Calls C++ function: int QFrame::frameStyle() const.

C++ documentation:

Returns the frame style.

The default value is QFrame::Plain.

See also setFrameStyle(), frameShape(), and frameShadow().

pub unsafe fn frame_width(&self) -> c_int[src]

This property holds the width of the frame that is drawn.

Calls C++ function: int QFrame::frameWidth() const.

C++ documentation:

This property holds the width of the frame that is drawn.

Note that the frame width depends on the frame style, not only the line width and the mid-line width. For example, the style specified by NoFrame always has a frame width of 0, whereas the style Panel has a frame width equivalent to the line width.

Access functions:

int frameWidth() const

See also lineWidth(), midLineWidth(), and frameStyle().

pub unsafe fn line_width(&self) -> c_int[src]

This property holds the line width

Calls C++ function: int QFrame::lineWidth() const.

C++ documentation:

This property holds the line width

Note that the total line width for frames used as separators (HLine and VLine) is specified by frameWidth.

The default value is 1.

Access functions:

int lineWidth() const
void setLineWidth(int)

See also midLineWidth and frameWidth.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QFrame::metaObject() const.

pub unsafe fn mid_line_width(&self) -> c_int[src]

This property holds the width of the mid-line

Calls C++ function: int QFrame::midLineWidth() const.

C++ documentation:

This property holds the width of the mid-line

The default value is 0.

Access functions:

int midLineWidth() const
void setMidLineWidth(int)

See also lineWidth and frameWidth.

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QFrame::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QFrame::qt_metacast(const char* arg1).

pub unsafe fn set_frame_rect(&mut self, arg1: impl CastInto<Ref<QRect>>)[src]

This property holds the frame's rectangle

Calls C++ function: void QFrame::setFrameRect(const QRect& arg1).

C++ documentation:

This property holds the frame's rectangle

The frame's rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting the rectangle does does not cause a widget update. The frame rectangle is automatically adjusted when the widget changes size.

If you set the rectangle to a null rectangle (for example, QRect(0, 0, 0, 0)), then the resulting frame rectangle is equivalent to the widget rectangle.

Access functions:

QRect frameRect() const
void setFrameRect(const QRect &)

pub unsafe fn set_frame_shadow(&mut self, arg1: Shadow)[src]

This property holds the frame shadow value from the frame style

Calls C++ function: void QFrame::setFrameShadow(QFrame::Shadow arg1).

C++ documentation:

This property holds the frame shadow value from the frame style

Access functions:

Shadow frameShadow() const
void setFrameShadow(Shadow)

See also frameStyle() and frameShape().

pub unsafe fn set_frame_shape(&mut self, arg1: Shape)[src]

This property holds the frame shape value from the frame style

Calls C++ function: void QFrame::setFrameShape(QFrame::Shape arg1).

C++ documentation:

This property holds the frame shape value from the frame style

Access functions:

Shape frameShape() const
void setFrameShape(Shape)

See also frameStyle() and frameShadow().

pub unsafe fn set_frame_style(&mut self, arg1: c_int)[src]

Sets the frame style to style.

Calls C++ function: void QFrame::setFrameStyle(int arg1).

C++ documentation:

Sets the frame style to style.

The style is the bitwise OR between a frame shape and a frame shadow style. See the picture of the frames in the main class documentation.

The frame shapes are given in QFrame::Shape and the shadow styles in QFrame::Shadow.

If a mid-line width greater than 0 is specified, an additional line is drawn for Raised or Sunken Box, HLine, and VLine frames. The mid-color of the current color group is used for drawing middle lines.

See also frameStyle().

pub unsafe fn set_line_width(&mut self, arg1: c_int)[src]

This property holds the line width

Calls C++ function: void QFrame::setLineWidth(int arg1).

C++ documentation:

This property holds the line width

Note that the total line width for frames used as separators (HLine and VLine) is specified by frameWidth.

The default value is 1.

Access functions:

int lineWidth() const
void setLineWidth(int)

See also midLineWidth and frameWidth.

pub unsafe fn set_mid_line_width(&mut self, arg1: c_int)[src]

This property holds the width of the mid-line

Calls C++ function: void QFrame::setMidLineWidth(int arg1).

C++ documentation:

This property holds the width of the mid-line

The default value is 0.

Access functions:

int midLineWidth() const
void setMidLineWidth(int)

See also lineWidth and frameWidth.

pub unsafe fn size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QWidget::sizeHint().

Calls C++ function: virtual QSize QFrame::sizeHint() const.

C++ documentation:

Reimplemented from QWidget::sizeHint().

Trait Implementations

impl CppDeletable for QLabel[src]

unsafe fn delete(&mut self)[src]

Destroys the label.

Calls C++ function: virtual [destructor] void QLabel::~QLabel().

C++ documentation:

Destroys the label.

impl Deref for QLabel[src]

type Target = QFrame

The resulting type after dereferencing.

fn deref(&self) -> &QFrame[src]

Calls C++ function: QFrame* static_cast<QFrame*>(QLabel* ptr).

impl DerefMut for QLabel[src]

fn deref_mut(&mut self) -> &mut QFrame[src]

Calls C++ function: QFrame* static_cast<QFrame*>(QLabel* ptr).

impl DynamicCast<QLabel> for QFrame[src]

unsafe fn dynamic_cast(ptr: Ptr<QFrame>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QFrame* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QFrame>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QFrame* ptr).

impl DynamicCast<QLabel> for QWidget[src]

unsafe fn dynamic_cast(ptr: Ptr<QWidget>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QWidget* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QWidget>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QWidget* ptr).

impl DynamicCast<QLabel> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QObject* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QObject* ptr).

impl DynamicCast<QLabel> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QPaintDevice* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* dynamic_cast<QLabel*>(QPaintDevice* ptr).

impl StaticDowncast<QLabel> for QFrame[src]

unsafe fn static_downcast(ptr: Ptr<QFrame>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QFrame* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QFrame>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QFrame* ptr).

impl StaticDowncast<QLabel> for QWidget[src]

unsafe fn static_downcast(ptr: Ptr<QWidget>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QWidget* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QWidget>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QWidget* ptr).

impl StaticDowncast<QLabel> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QObject* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QObject* ptr).

impl StaticDowncast<QLabel> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QPaintDevice* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QLabel>[src]

Calls C++ function: QLabel* static_cast<QLabel*>(QPaintDevice* ptr).

impl StaticUpcast<QFrame> for QLabel[src]

unsafe fn static_upcast(ptr: Ptr<QLabel>) -> Ptr<QFrame>[src]

Calls C++ function: QFrame* static_cast<QFrame*>(QLabel* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QLabel>) -> MutPtr<QFrame>[src]

Calls C++ function: QFrame* static_cast<QFrame*>(QLabel* ptr).

impl StaticUpcast<QObject> for QLabel[src]

unsafe fn static_upcast(ptr: Ptr<QLabel>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QLabel* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QLabel>) -> MutPtr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QLabel* ptr).

impl StaticUpcast<QPaintDevice> for QLabel[src]

unsafe fn static_upcast(ptr: Ptr<QLabel>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QLabel* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QLabel>) -> MutPtr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QLabel* ptr).

impl StaticUpcast<QWidget> for QLabel[src]

unsafe fn static_upcast(ptr: Ptr<QLabel>) -> Ptr<QWidget>[src]

Calls C++ function: QWidget* static_cast<QWidget*>(QLabel* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QLabel>) -> MutPtr<QWidget>[src]

Calls C++ function: QWidget* static_cast<QWidget*>(QLabel* ptr).

Auto Trait Implementations

impl RefUnwindSafe for QLabel

impl Send for QLabel

impl Sync for QLabel

impl Unpin for QLabel

impl UnwindSafe for QLabel

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.