cf::ui::widget::material::TextArea¶
Material Design 3 TextArea widget. More...
#include <textarea.h>
Inherits from QTextEdit
Public Types¶
| Name | |
|---|---|
| enum class | TextAreaVariant { Filled, Outlined} TextArea visual variant. |
Public Signals¶
| Name | |
|---|---|
| void | floatingChanged(bool floating) Signal emitted when floating state changes. |
Public Functions¶
| Name | |
|---|---|
| Q_ENUM(TextAreaVariant ) | |
| TextArea(TextAreaVariant variant =TextAreaVariant::Filled, QWidget * parent =nullptr) Constructor with variant. |
|
| TextArea(constQString & text, TextAreaVariant variant =TextAreaVariant::Filled, QWidget * parent =nullptr) Constructor with text and variant. |
|
| ~TextArea() override Destructor. |
|
| TextAreaVariant | variant() const Gets the text area variant. |
| void | setVariant(TextAreaVariant variant) Sets the text area variant. |
| QString | label() const Gets the label text. |
| void | setLabel(constQString & label) Sets the label text. |
| QString | helperText() const Gets the helper text. |
| void | setHelperText(constQString & text) Sets the helper text. |
| QString | errorText() const Gets the error text. |
| void | setErrorText(constQString & text) Sets the error text. |
| bool | isFloating() const Checks if the label is in floating state. |
| bool | showCharacterCounter() const Gets whether character counter is shown. |
| void | setShowCharacterCounter(bool show) Sets whether character counter is shown. |
| int | maxLength() const Gets the maximum length. |
| void | setMaxLength(int length) Sets the maximum length. |
| int | minLines() const Gets the minimum number of visible lines. |
| void | setMinLines(int lines) Sets the minimum number of visible lines. |
| int | maxLines() const Gets the maximum number of visible lines. |
| void | setMaxLines(int lines) Sets the maximum number of visible lines. |
| 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 text area. |
| void | resizeEvent(QResizeEvent * event) override Handles resize event. |
| void | mousePressEvent(QMouseEvent * event) override Handles mouse press event. |
| void | mouseReleaseEvent(QMouseEvent * event) override Handles mouse release event. |
| void | focusInEvent(QFocusEvent * event) override Handles focus in event. |
| void | focusOutEvent(QFocusEvent * event) override Handles focus out event. |
| void | changeEvent(QEvent * event) override Handles widget state change event. |
| void | keyPressEvent(QKeyEvent * event) override Handles key press event. |
| void | textChanged() Handles text change event. |
Public Properties¶
| Name | |
|---|---|
| TextAreaVariant | variant |
| QString | label |
| QString | helperText |
| QString | errorText |
| int | maxLength |
| bool | showCharacterCounter |
| bool | isFloating |
| int | minLines |
| int | maxLines |
Detailed Description¶
Material Design 3 TextArea widget.
Since: 0.1
Implements Material Design 3 text area with support for filled and outlined variants. Includes floating labels, character counter, helper/error text, and multi-line text input with auto-resize support.
Public Types Documentation¶
enum TextAreaVariant¶
| Enumerator | Value | Description |
|---|---|---|
| Filled | ||
| Outlined |
TextArea visual variant.
Since: 0.1
Public Signals Documentation¶
signal floatingChanged¶
Signal emitted when floating state changes.
Parameters:
- floating true if label is floating, false otherwise.
Since: 0.1
Public Functions Documentation¶
function Q_ENUM¶
function TextArea¶
Constructor with variant.
Parameters:
- variant TextArea visual variant.
- parent QObject parent.
Exceptions:
- None
Since: 0.1
Note: None
Warning: None
function TextArea¶
explicit TextArea(
constQString & text,
TextAreaVariant variant =TextAreaVariant::Filled,
QWidget * parent =nullptr
)
Constructor with text and variant.
Parameters:
- text Initial text content.
- variant TextArea visual variant.
- parent QObject parent.
Exceptions:
- None
Since: 0.1
Note: None
Warning: None
function ~TextArea¶
Destructor.
Exceptions:
- None
Since: 0.1
Note: None
Warning: None
function variant¶
Gets the text area variant.
Exceptions:
- None
Return: Current text area variant.
Since: 0.1
Note: None
Warning: None
function setVariant¶
Sets the text area variant.
Parameters:
- variant TextArea variant to use.
Exceptions:
- None
Since: 0.1
Note: Changing variant updates the visual appearance.
Warning: None
function label¶
Gets the label text.
Exceptions:
- None
Return: Current label text.
Since: 0.1
Note: The label floats when the field has focus or content.
Warning: None
function setLabel¶
Sets the label text.
Parameters:
- label Label text to display.
Exceptions:
- None
Since: 0.1
Note: The label floats when the field has focus or content.
Warning: None
function helperText¶
Gets the helper text.
Exceptions:
- None
Return: Current helper text.
Since: 0.1
Note: Helper text is displayed below the text area.
Warning: None
function setHelperText¶
Sets the helper text.
Parameters:
- text Helper text to display.
Exceptions:
- None
Since: 0.1
Note: Helper text is displayed below the text area.
Warning: None
function errorText¶
Gets the error text.
Exceptions:
- None
Return: Current error text.
Since: 0.1
Note: Error text takes precedence over helper text.
Warning: None
function setErrorText¶
Sets the error text.
Parameters:
- text Error text to display. Empty string clears error state.
Exceptions:
- None
Since: 0.1
Note: Error text takes precedence over helper text.
Warning: None
function isFloating¶
Checks if the label is in floating state.
Exceptions:
- None
Return: true if label is floating, false otherwise.
Since: 0.1
Note: Label floats when field has focus or content.
Warning: None
function showCharacterCounter¶
Gets whether character counter is shown.
Exceptions:
- None
Return: true if character counter is visible, false otherwise.
Since: 0.1
Note: Character counter is shown in the helper text area.
Warning: None
function setShowCharacterCounter¶
Sets whether character counter is shown.
Parameters:
- show true to show character counter, false to hide.
Exceptions:
- None
Since: 0.1
Note: Character counter is shown in the helper text area.
Warning: None
function maxLength¶
Gets the maximum length.
Exceptions:
- None
Return: Maximum character length.
Since: 0.1
Note: 0 means no maximum.
Warning: None
function setMaxLength¶
Sets the maximum length.
Parameters:
- length Maximum character length. 0 means no maximum.
Exceptions:
- None
Since: 0.1
Note: 0 means no maximum.
Warning: None
function minLines¶
Gets the minimum number of visible lines.
Exceptions:
- None
Return: Minimum number of lines.
Since: 0.1
Note: Default is 1.
Warning: None
function setMinLines¶
Sets the minimum number of visible lines.
Parameters:
- lines Minimum number of visible lines.
Exceptions:
- None
Since: 0.1
Note: Affects the minimum height of the text area.
Warning: None
function maxLines¶
Gets the maximum number of visible lines.
Exceptions:
- None
Return: Maximum number of lines, or 0 for unlimited.
Since: 0.1
Note: 0 means no maximum (scrollbar appears).
Warning: None
function setMaxLines¶
Sets the maximum number of visible lines.
Parameters:
- lines Maximum number of visible lines, or 0 for unlimited.
Exceptions:
- None
Since: 0.1
Note: When set, the text area grows up to this many lines.
Warning: None
function sizeHint¶
Gets the recommended size.
Exceptions:
- None
Return: Recommended size for the text area.
Since: 0.1
Note: Based on label, padding, helper text, and line count.
Warning: None
function minimumSizeHint¶
Gets the minimum recommended size.
Exceptions:
- None
Return: Minimum recommended size.
Since: 0.1
Note: Ensures touch target size requirements.
Warning: None
Protected Functions Documentation¶
function paintEvent¶
Paints the text area.
Parameters:
- event Paint event.
Exceptions:
- None
Since: 0.1
Note: Implements Material Design paint pipeline.
Warning: None
function resizeEvent¶
Handles resize event.
Parameters:
- event Resize event.
Exceptions:
- None
Since: 0.1
Note: Updates internal layout calculations.
Warning: None
function mousePressEvent¶
Handles mouse press event.
Parameters:
- event Mouse event.
Exceptions:
- None
Since: 0.1
Note: Triggers ripple effect.
Warning: None
function mouseReleaseEvent¶
Handles mouse release event.
Parameters:
- event Mouse event.
Exceptions:
- None
Since: 0.1
Note: Updates ripple state.
Warning: None
function focusInEvent¶
Handles focus in event.
Parameters:
- event Focus event.
Exceptions:
- None
Since: 0.1
Note: Updates floating label state and shows focus indicator.
Warning: None
function focusOutEvent¶
Handles focus out event.
Parameters:
- event Focus event.
Exceptions:
- None
Since: 0.1
Note: Updates floating label state and hides focus indicator.
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
function keyPressEvent¶
Handles key press event.
Parameters:
- event Key event.
Exceptions:
- None
Since: 0.1
Note: Blocks Enter key when maxLines limit is reached.
Warning: None
function textChanged¶
Handles text change event.
Parameters:
- text New text content.
Exceptions:
- None
Since: 0.1
Note: Updates floating label state and character counter.
Warning: None
Public Property Documentation¶
property variant¶
property label¶
property helperText¶
property errorText¶
property maxLength¶
property showCharacterCounter¶
property isFloating¶
property minLines¶
property maxLines¶
Updated on 2026-03-09 at 10:14:00 +0000