NDEVR
API Documentation
QCustomLabel

Displays translated text. More...

Collaboration diagram for QCustomLabel:
[legend]

Public Types

enum  Theme { e_header_a , e_label_a , e_label_b }
 Options for how to display the label. More...

Public Member Functions

 QCustomLabel (const QString &text, QWidget *parent=nullptr)
 Constructs a QCustomLabel with a QString and the given parent widget.
 QCustomLabel (const TranslatedString &text, QWidget *parent=nullptr)
 Constructs a QCustomLabel with translated text and the given parent widget.
 QCustomLabel (QWidget *parent=nullptr)
 Constructs a QCustomLabel with the given parent widget.
bool event (QEvent *event) override
 Handles generic events such as theme and font changes.
QSize minimumSizeHint () const override
 Returns the minimum size hint, accounting for vertical orientation.
void paintEvent (QPaintEvent *e) override
 Custom paint event that handles vertical and flipped text rendering.
void setBold (bool is_bold)
 Sets whether the label text is rendered in bold.
void setFlipped (bool flipped)
 Sets whether the label text is rendered upside-down (flipped 180 degrees).
void setFontMultiplier (fltp04 font_multiplier)
 Sets a multiplier applied to the base font size.
void setLabelTheme (Theme theme)
 Sets the visual theme of the label.
void setText (const char *text)
 Sets the label text from a C-string.
void setText (const QString &text)
 Sets the label text from a QString.
void setText (const String &text)
 Sets the label text from an NDEVR String.
void setText (const TranslatedString &text)
 Sets the label text from a TranslatedString.
void setVertical (bool vertical)
 Sets whether the label text is rendered vertically.
QSize sizeHint () const override
 Returns the recommended size, accounting for vertical orientation.
TranslatedString text () const
 Returns the current label text as a TranslatedString.

Static Public Attributes

static Resource< fltp08default_multiplier_desktop
 Default font multiplier for desktop mode.
static Resource< fltp08default_multiplier_touch
 Default font multiplier for touch mode.

Protected Member Functions

void init ()
 Initializes the label with default settings.
void updateFont ()
 Updates the font based on the current multiplier, bold, and theme settings.

Protected Attributes

fltp04 m_font_multiplier
 The current font size multiplier.
bool m_is_bold = false
 Whether the text is rendered in bold.
bool m_is_flipped = false
 Whether the text is rendered upside-down.
bool m_is_vertical = false
 Whether the text is rendered vertically.
Theme m_theme
 The current visual theme.
TranslatedString m_translated_text
 The stored translated text.

Detailed Description

Displays translated text.


No user interaction functionality is provided. The visual appearance of the label can be configured in various ways.

Definition at line 46 of file QCustomLabel.h.

Member Enumeration Documentation

◆ Theme

Options for how to display the label.


Enumerator
e_header_a 

For titles: standard foreground color with bold font.

e_label_a 

Default label style: uses highlight color.

e_label_b 

Alternative label style: standard foreground color.

Definition at line 52 of file QCustomLabel.h.

Constructor & Destructor Documentation

◆ QCustomLabel() [1/3]

QCustomLabel::QCustomLabel ( QWidget * parent = nullptr)

Constructs a QCustomLabel with the given parent widget.

Parameters
[in]parentThe parent widget.

◆ QCustomLabel() [2/3]

QCustomLabel::QCustomLabel ( const TranslatedString & text,
QWidget * parent = nullptr )

Constructs a QCustomLabel with translated text and the given parent widget.

Parameters
[in]textThe translated text to display.
[in]parentThe parent widget.

References text().

◆ QCustomLabel() [3/3]

QCustomLabel::QCustomLabel ( const QString & text,
QWidget * parent = nullptr )

Constructs a QCustomLabel with a QString and the given parent widget.

Parameters
[in]textThe text to display.
[in]parentThe parent widget.

References text().

Member Function Documentation

◆ event()

bool QCustomLabel::event ( QEvent * event)
override

Handles generic events such as theme and font changes.

Parameters
[in]eventThe event to handle.
Returns
True if the event was handled, false otherwise.

References event().

Referenced by event().

◆ minimumSizeHint()

QSize QCustomLabel::minimumSizeHint ( ) const
override

Returns the minimum size hint, accounting for vertical orientation.

Returns
The minimum size hint.

◆ paintEvent()

void QCustomLabel::paintEvent ( QPaintEvent * e)
override

Custom paint event that handles vertical and flipped text rendering.

Parameters
[in]eThe paint event.

◆ setBold()

void QCustomLabel::setBold ( bool is_bold)

Sets whether the label text is rendered in bold.

Parameters
[in]is_boldWhether the text should be bold.

◆ setFlipped()

void QCustomLabel::setFlipped ( bool flipped)

Sets whether the label text is rendered upside-down (flipped 180 degrees).

Parameters
[in]flippedWhether to flip the text.

◆ setFontMultiplier()

void QCustomLabel::setFontMultiplier ( fltp04 font_multiplier)

Sets a multiplier applied to the base font size.

Parameters
[in]font_multiplierThe font size multiplier.

◆ setLabelTheme()

void QCustomLabel::setLabelTheme ( Theme theme)

Sets the visual theme of the label.

Parameters
[in]themeThe theme to apply.

◆ setText() [1/4]

void QCustomLabel::setText ( const char * text)

Sets the label text from a C-string.

Parameters
[in]textThe text to display.

References text().

◆ setText() [2/4]

void QCustomLabel::setText ( const QString & text)

Sets the label text from a QString.

Parameters
[in]textThe text to display.

References text().

◆ setText() [3/4]

void QCustomLabel::setText ( const String & text)

Sets the label text from an NDEVR String.

Parameters
[in]textThe text to display.

References text().

◆ setText() [4/4]

void QCustomLabel::setText ( const TranslatedString & text)

Sets the label text from a TranslatedString.

Parameters
[in]textThe translated text to display.

References text().

◆ setVertical()

void QCustomLabel::setVertical ( bool vertical)

Sets whether the label text is rendered vertically.

Parameters
[in]verticalWhether to render text vertically.

◆ sizeHint()

QSize QCustomLabel::sizeHint ( ) const
override

Returns the recommended size, accounting for vertical orientation.

Returns
The size hint.

◆ text()

TranslatedString QCustomLabel::text ( ) const

Returns the current label text as a TranslatedString.

Returns
The translated text.

Referenced by QCustomLabel(), QCustomLabel(), setText(), setText(), setText(), and setText().


The documentation for this class was generated from the following file: