Skip to content

PythonQt.QtGui.QLabel · declarations 001

Back to PythonQt.QtGui.QLabel

alignment instance-attribute

alignment: Any

Qt 5 reference:

alignment : Qt::Alignment

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.

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#alignment

buddy

buddy() -> Any

X.buddy() -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

QWidget *QLabel::buddy() const

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

See also setBuddy().

Upstream PySide2 reference signatures (binding differences may apply):

buddy(self) -> PySide2.QtWidgets.QWidget

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#buddy

changeEvent

changeEvent(arg__1: Any) -> None

X.changeEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::changeEvent(QEvent *ev)

Reimplements: QFrame::changeEvent(QEvent *ev).

Upstream PySide2 reference signatures (binding differences may apply):

changeEvent(self, arg__1: PySide2.QtCore.QEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#changeEvent

clear

clear() -> None

X.clear()

Supplemental documentation: Qt 5 reference:

[slot] void QLabel::clear()

Clears any label contents.

Upstream PySide2 reference signatures (binding differences may apply):

clear(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#clear

contextMenuEvent

contextMenuEvent(ev: Any) -> None

X.contextMenuEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::contextMenuEvent(QContextMenuEvent *ev)

Reimplements: QWidget::contextMenuEvent(QContextMenuEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

contextMenuEvent(self, ev: PySide2.QtGui.QContextMenuEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#contextMenuEvent

customContextMenuRequested

customContextMenuRequested(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLabel.customContextMenuRequested; argument details are not documented.

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLabel.destroyed; argument details are not documented.

event

event(e: Any) -> bool

X.event(e) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QLabel::event(QEvent *e)

Reimplements: QFrame::event(QEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

event(self, e: PySide2.QtCore.QEvent) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#event

focusInEvent

focusInEvent(ev: Any) -> None

X.focusInEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::focusInEvent(QFocusEvent *ev)

Reimplements: QWidget::focusInEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusInEvent(self, ev: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#focusInEvent

focusNextPrevChild

focusNextPrevChild(next: bool) -> bool

X.focusNextPrevChild(next) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QLabel::focusNextPrevChild(bool next)

Reimplements: QWidget::focusNextPrevChild(bool next).

Upstream PySide2 reference signatures (binding differences may apply):

focusNextPrevChild(self, next: bool) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#focusNextPrevChild

focusOutEvent

focusOutEvent(ev: Any) -> None

X.focusOutEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::focusOutEvent(QFocusEvent *ev)

Reimplements: QWidget::focusOutEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusOutEvent(self, ev: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#focusOutEvent

hasScaledContents

hasScaledContents() -> bool

X.hasScaledContents() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

hasScaledContents(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#hasScaledContents

hasSelectedText instance-attribute

hasSelectedText: bool

Qt 5 reference:

hasSelectedText : const bool

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#hasSelectedText

heightForWidth

heightForWidth(arg__1: int) -> int

X.heightForWidth(arg__1) -> int

Supplemental documentation: Qt 5 reference:

[override virtual] int QLabel::heightForWidth(int w) const

Reimplements: QWidget::heightForWidth(int w) const.

Upstream PySide2 reference signatures (binding differences may apply):

heightForWidth(self, arg__1: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#heightForWidth

indent instance-attribute

indent: int

Qt 5 reference:

indent : int

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#indent

keyPressEvent

keyPressEvent(ev: Any) -> None

X.keyPressEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::keyPressEvent(QKeyEvent *ev)

Reimplements: QWidget::keyPressEvent(QKeyEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

keyPressEvent(self, ev: PySide2.QtGui.QKeyEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#keyPressEvent

linkActivated

linkActivated(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLabel.linkActivated; argument details are not documented.

Supplemental documentation: Qt 5 reference:

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#linkActivated

linkHovered

linkHovered(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLabel.linkHovered; argument details are not documented.

Supplemental documentation: Qt 5 reference:

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#linkHovered

margin instance-attribute

margin: int

Qt 5 reference:

margin : int

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.

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#margin

minimumSizeHint instance-attribute

minimumSizeHint: QSize

Qt 5 reference:

[override virtual] QSize QLabel::minimumSizeHint() const

Reimplements an access function for property: QWidget::minimumSizeHint.

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#minimumSizeHint

mouseMoveEvent

mouseMoveEvent(ev: Any) -> None

X.mouseMoveEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::mouseMoveEvent(QMouseEvent *ev)

Reimplements: QWidget::mouseMoveEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mouseMoveEvent(self, ev: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#mouseMoveEvent

mousePressEvent

mousePressEvent(ev: Any) -> None

X.mousePressEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::mousePressEvent(QMouseEvent *ev)

Reimplements: QWidget::mousePressEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mousePressEvent(self, ev: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#mousePressEvent

mouseReleaseEvent

mouseReleaseEvent(ev: Any) -> None

X.mouseReleaseEvent(ev)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::mouseReleaseEvent(QMouseEvent *ev)

Reimplements: QWidget::mouseReleaseEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mouseReleaseEvent(self, ev: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#mouseReleaseEvent

movie

movie() -> Any

X.movie() -> PythonQt.QtGui.QMovie

Supplemental documentation: Qt 5 reference:

QMovie *QLabel::movie() const

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

See also setMovie().

Upstream PySide2 reference signatures (binding differences may apply):

movie(self) -> PySide2.QtGui.QMovie

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#movie

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLabel.objectNameChanged; argument details are not documented.

openExternalLinks: bool

Qt 5 reference:

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#openExternalLinks

paintEvent

paintEvent(arg__1: Any) -> None

X.paintEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLabel::paintEvent(QPaintEvent *)

Reimplements: QFrame::paintEvent(QPaintEvent *).

Upstream PySide2 reference signatures (binding differences may apply):

paintEvent(self, arg__1: PySide2.QtGui.QPaintEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#paintEvent

picture

picture() -> Any

X.picture() -> PythonQt.QtGui.QPicture

Supplemental documentation: Qt 5 reference:

QPicture QLabel::picture(Qt::ReturnByValueConstant) const

Returns the label's picture.

Previously, Qt provided a version of picture() which returned the picture by-pointer. That version is now deprecated. To maintain compatibility with old code, you can explicitly differentiate between the by-pointer function and the by-value function:

const QPicture *picPtr = label->picture();
QPicture picVal = label->picture(Qt::ReturnByValue);

If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE macro, then you can omit Qt::ReturnByValue as shown below:

QPicture picVal = label->picture();

This function was introduced in Qt 5.15.

Upstream PySide2 reference signatures (binding differences may apply):

picture(self) -> PySide2.QtGui.QPicture

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#picture

pixmap instance-attribute

pixmap: QPixmap

Qt 5 reference:

pixmap : QPixmap

This property holds the label's pixmap.

Previously, Qt provided a version of pixmap() which returned the pixmap by-pointer. That version is now deprecated. To maintain compatibility with old code, you can explicitly differentiate between the by-pointer function and the by-value function:

const QPixmap *pixmapPtr = label->pixmap();
QPixmap pixmapVal = label->pixmap(Qt::ReturnByValue);

If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE macro, then you can omit Qt::ReturnByValue as shown below:

QPixmap pixmapVal = label->pixmap();

If no pixmap has been set, the deprecated getter function will return nullptr.

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

Access functions:

QPixmap pixmap(Qt::ReturnByValueConstant) const
void setPixmap(const QPixmap \&)

QPixmap QLabel::pixmap(Qt::ReturnByValueConstant) const

Note: Getter function for property pixmap.

This function was introduced in Qt 5.15.

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#pixmap

scaledContents instance-attribute

scaledContents: Any

Qt 5 reference:

scaledContents : bool

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)

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#scaledContents

selectedText instance-attribute

selectedText: str

Qt 5 reference:

selectedText : const QString

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

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#selectedText

selectionStart

selectionStart() -> int

X.selectionStart() -> int

Supplemental documentation: Qt 5 reference:

int QLabel::selectionStart() const

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

Upstream PySide2 reference signatures (binding differences may apply):

selectionStart(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#selectionStart

setAlignment

setAlignment(arg__1: Any) -> None

X.setAlignment(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setAlignment(self, arg__1: PySide2.QtCore.Qt.Alignment) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setAlignment

setBuddy

setBuddy(arg__1: Any) -> None

X.setBuddy(arg__1)

Supplemental documentation: Qt 5 reference:

void QLabel::setBuddy(QWidget *buddy)

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 nullptr.

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

Upstream PySide2 reference signatures (binding differences may apply):

setBuddy(self, arg__1: PySide2.QtWidgets.QWidget) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setBuddy

setIndent

setIndent(arg__1: int) -> None

X.setIndent(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setIndent(self, arg__1: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setIndent

setMargin

setMargin(arg__1: int) -> None

X.setMargin(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setMargin(self, arg__1: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setMargin

setMovie

setMovie(movie: Any) -> None

X.setMovie(movie)

Supplemental documentation: Qt 5 reference:

[slot] void QLabel::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().

Upstream PySide2 reference signatures (binding differences may apply):

setMovie(self, movie: PySide2.QtGui.QMovie) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setMovie

setNum

setNum(a: Any) -> None

X.setNum(a)

Supplemental documentation: Qt 5 reference:

[slot] void QLabel::setNum(double num)

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

[slot] void QLabel::setNum(int num)

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

Upstream PySide2 reference signatures (binding differences may apply):

setNum(self, arg__1: float) -> None
setNum(self, arg__1: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setNum

setOpenExternalLinks(open: bool) -> None

X.setOpenExternalLinks(open)

Upstream PySide2 reference signatures (binding differences may apply):

setOpenExternalLinks(self, open: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setOpenExternalLinks

setPicture

setPicture(a: Any) -> None

X.setPicture(a)

Supplemental documentation: Qt 5 reference:

[slot] void QLabel::setPicture(const QPicture \&picture)

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

The buddy shortcut, if any, is disabled.

See also picture() and setBuddy().

Upstream PySide2 reference signatures (binding differences may apply):

setPicture(self, arg__1: PySide2.QtGui.QPicture) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlabel.html#setPicture