FixedSizeClickLabel Class

class Utils::FixedSizeClickLabel

The FixedSizeClickLabel class is a label with a size hint derived from a sample text that can be different to the text that is shown. More...

Header: #include <FixedSizeClickLabel>
Inherits: QLabel

Properties

Public Functions

FixedSizeClickLabel(QWidget *parent = nullptr)
QString maxText() const
void setMaxText(const QString &maxText)
void setText(const QString &text, const QString &maxText)

Reimplemented Public Functions

virtual QSize sizeHint() const override

Signals

void clicked()

Reimplemented Protected Functions

virtual void mousePressEvent(QMouseEvent *ev) override
virtual void mouseReleaseEvent(QMouseEvent *ev) override

Detailed Description

For convenience it also has a clicked signal that is emitted whenever the label receives a mouse click.

Property Documentation

maxText : QString

This property holds the text that is used to calculate the label's size hint.

Access functions:

QString maxText() const
void setMaxText(const QString &maxText)

Member Function Documentation

FixedSizeClickLabel::FixedSizeClickLabel(QWidget *parent = nullptr)

Constructs a FixedSizeClickLabel with the parent parent.

[signal] void FixedSizeClickLabel::clicked()

This signal is emitted when the label is clicked with the left mouse button.

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

Reimplements: QLabel::mousePressEvent(QMouseEvent *ev).

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

Reimplements: QLabel::mouseReleaseEvent(QMouseEvent *ev).

void FixedSizeClickLabel::setText(const QString &text, const QString &maxText)

Sets the label's text to text, and changes the size hint of the label to the size of maxText.

See also maxText and setMaxText.

[override virtual] QSize FixedSizeClickLabel::sizeHint() const

Reimplements: QLabel::sizeHint() const.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.