#include <ElidingLabel.h>
Inherits QLabel.
Public Member Functions | |
ElidingLabel (const QString &text, QWidget *parent=nullptr) | |
ElidingLabel (QWidget *parent=nullptr) | |
void | SetText (const QString &text) |
Sets the label text. | |
void | setText (const QString &text) |
Sets the label text. | |
const QString & | Text () const |
Returns the full label text. | |
const QString & | text () const |
Returns the full label text. | |
const QString & | ElidedText () |
Returns the elided text of the label as it is currently shown. | |
const QString & | elidedText () |
Returns the elided text of the label as it is currently shown. | |
void | SetFilter (const QString &filter) |
Set the label's filter string. | |
void | setFilter (const QString &filter) |
bool | TextMatchesFilter () const |
void | SetDescription (const QString &description) |
Sets the description for this label. | |
void | setDescription (const QString &description) |
const QString & | Description () const |
Returns the description for this label. | |
const QString & | description () const |
Returns the description for this label. | |
void | SetElideMode (Qt::TextElideMode mode) |
Sets the location of the ellipsis when eliding label text. | |
void | setElideMode (Qt::TextElideMode mode) |
Sets the location of the ellipsis when eliding label text. | |
void | RefreshStyle () |
Refreshes the style on the label. | |
void | refreshStyle () |
Refreshes the style on the label. | |
void | setObjectName (const QString &name) |
Sets the object name for the label. | |
QSize | minimumSizeHint () const override |
Overrides the QLabel minimumSizeHint function to allow it to be shrunk further than its content. | |
QSize | sizeHint () const override |
Overrides the QLabel sizeHint function to return the elided text size. | |
void | handleElision () |
Protected Attributes | |
QString | m_filterString |
QRegExp | m_filterRegex |
Extends the QLabel widget to automatically elide the label text with an ellipsis (...) if it doesn't fit within the width of the widget. On hover, a tooltip will show the full label text, plus an optional description.
void AzQtComponents::ElidingLabel::setDescription | ( | const QString & | description | ) |
Sets the description for this label. The description is shown in the label's tooltip, either on its own or alongside the full text in case of elision.
void AzQtComponents::ElidingLabel::setFilter | ( | const QString & | filter | ) |
Set the label's filter string. If the filter string is a substring of the current text, it will appear highlighted in the label. Used in conjunction with search filters to highlight results.
bool AzQtComponents::ElidingLabel::TextMatchesFilter | ( | ) | const |
Returns if the label text matches the current filter string. If no filter string has been set, returns true.