cf::ui::widget::material::Label¶
Material Design 3 Label widget. More...
#include <label.h>
Inherits from QLabel
Public Functions¶
| Name | |
|---|---|
| Label(constQString & text =QString(), TypographyStyle style =TypographyStyle::BodyMedium, QWidget * parent =nullptr) Constructor with text and style. |
|
| ~Label() override Destructor. |
|
| TypographyStyle | typographyStyle() const Gets the typography style. |
| void | setTypographyStyle(TypographyStyle style) Sets the typography style. |
| LabelColorVariant | colorVariant() const Gets the color variant. |
| void | setColorVariant(LabelColorVariant variant) Sets the color variant. |
| bool | autoHiding() const Gets whether auto-hiding is enabled. |
| void | setAutoHiding(bool enabled) Sets whether auto-hiding is enabled. |
| QSize | sizeHint() const override Gets the recommended size. |
| QSize | minimumSizeHint() const override Gets the minimum recommended size. |
Protected Functions¶
| Name | |
|---|---|
| void | paintEvent(QPaintEvent * event) override Paints the label. |
| void | changeEvent(QEvent * event) override Handles widget state change event. |
Public Properties¶
| Name | |
|---|---|
| TypographyStyle | typographyStyle |
| LabelColorVariant | colorVariant |
| bool | autoHiding |
Detailed Description¶
Material Design 3 Label widget.
Since: 0.1
Implements Material Design 3 label with:
- 15 typography styles from MD3 Type Scale
- 9 color variants for semantic coloring
- Theme-aware color and font resolution
- Disabled state with opacity
- Automatic theme change handling
Public Functions Documentation¶
function Label¶
explicit Label(
constQString & text =QString(),
TypographyStyle style =TypographyStyle::BodyMedium,
QWidget * parent =nullptr
)
Constructor with text and style.
Parameters:
- text Label text content.
- style Typography style.
- parent QObject parent.
Exceptions:
- None
Since: 0.1
Note: Default style is BodyMedium.
Warning: None
function ~Label¶
Destructor.
Exceptions:
- None
Since: 0.1
Note: None
Warning: None
function typographyStyle¶
Gets the typography style.
Exceptions:
- None
Return: Current typography style.
Since: 0.1
Note: None
Warning: None
function setTypographyStyle¶
Sets the typography style.
Parameters:
- style Typography style to apply.
Exceptions:
- None
Since: 0.1
Note: Updates font and triggers repaint.
Warning: None
function colorVariant¶
Gets the color variant.
Exceptions:
- None
Return: Current color variant.
Since: 0.1
Note: None
Warning: None
function setColorVariant¶
Sets the color variant.
Parameters:
- variant Color variant to apply.
Exceptions:
- None
Since: 0.1
Note: Updates text color and triggers repaint.
Warning: None
function autoHiding¶
Gets whether auto-hiding is enabled.
Exceptions:
- None
Return: true if label hides when empty, false otherwise.
Since: 0.1
Note: None
Warning: None
function setAutoHiding¶
Sets whether auto-hiding is enabled.
Parameters:
- enabled true to hide when text is empty, false otherwise.
Exceptions:
- None
Since: 0.1
Note: When enabled, label becomes hidden when text is empty.
Warning: None
function sizeHint¶
Gets the recommended size.
Exceptions:
- None
Return: Recommended size for the label.
Since: 0.1
Note: Based on text, font, and word wrap setting.
Warning: None
function minimumSizeHint¶
Gets the minimum recommended size.
Exceptions:
- None
Return: Minimum recommended size.
Since: 0.1
Note: Ensures minimum touch target size for interactive labels.
Warning: None
Protected Functions Documentation¶
function paintEvent¶
Paints the label.
Parameters:
- event Paint event.
Exceptions:
- None
Since: 0.1
Note: Renders text with theme-aware color and font.
Warning: None
function changeEvent¶
Handles widget state change event.
Parameters:
- event Change event.
Exceptions:
- None
Since: 0.1
Note: Updates appearance based on state changes.
Warning: None
Public Property Documentation¶
property typographyStyle¶
property colorVariant¶
property autoHiding¶
Updated on 2026-03-09 at 10:14:00 +0000