跳转至

cf::ui::widget::material::CheckBox

Material Design 3 CheckBox widget. More...

#include <checkbox.h>

Inherits from QCheckBox

Public Signals

Name
void errorChanged(bool error)
Signal emitted when error state changes.

Public Functions

Name
CheckBox(QWidget * parent =nullptr)
Constructor.
CheckBox(constQString & text, QWidget * parent =nullptr)
Constructor with text.
~CheckBox() override
Destructor.
void setChecked(bool checked)
Sets the checked state.
void setCheckState(Qt::CheckState state)
Sets the check state.
bool hasError() const
Gets whether the checkbox is in error state.
void setError(bool error)
Sets the error state.
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 checkbox.
void enterEvent(QEnterEvent * event) override
Handles mouse enter event.
void leaveEvent(QEvent * event) override
Handles mouse leave 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 nextCheckState() override
Handles check state change event.
bool hitButton(constQPoint & pos) const override
Determines if a point is within the clickable button area.

Public Properties

Name
bool error

Detailed Description

class cf::ui::widget::material::CheckBox;

Material Design 3 CheckBox widget.

Since: 0.1

Implements Material Design 3 checkbox with support for unchecked, checked, and indeterminate states. Includes ripple effects, state layers, and focus indicators following Material Design 3 specifications.

Public Signals Documentation

signal errorChanged

void errorChanged(
    bool error
)

Signal emitted when error state changes.

Parameters:

  • error The new error state.

Since: 0.1

Public Functions Documentation

function CheckBox

explicit CheckBox(
    QWidget * parent =nullptr
)

Constructor.

Parameters:

  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function CheckBox

explicit CheckBox(
    constQString & text,
    QWidget * parent =nullptr
)

Constructor with text.

Parameters:

  • text CheckBox text label.
  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function ~CheckBox

~CheckBox() override

Destructor.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function setChecked

void setChecked(
    bool checked
)

Sets the checked state.

Parameters:

  • checked true to check, false to uncheck.

Exceptions:

  • None

Since: 0.1

Note: Updates animation progress for correct rendering.

Warning: None

function setCheckState

void setCheckState(
    Qt::CheckState state
)

Sets the check state.

Parameters:

  • state The check state to set.

Exceptions:

  • None

Since: 0.1

Note: Updates animation progress for correct rendering.

Warning: None

function hasError

bool hasError() const

Gets whether the checkbox is in error state.

Exceptions:

  • None

Return: true if error state is active, false otherwise.

Since: 0.1

Note: Error state affects the border color.

Warning: None

function setError

void setError(
    bool error
)

Sets the error state.

Parameters:

  • error true to set error state, false to clear.

Exceptions:

  • None

Since: 0.1

Note: Error state uses error color for the border.

Warning: None

function sizeHint

QSize sizeHint() const override

Gets the recommended size.

Exceptions:

  • None

Return: Recommended size for the checkbox.

Since: 0.1

Note: Based on icon size, text, and spacing.

Warning: None

function minimumSizeHint

QSize minimumSizeHint() const override

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

void paintEvent(
    QPaintEvent * event
) override

Paints the checkbox.

Parameters:

  • event Paint event.

Exceptions:

  • None

Since: 0.1

Note: Implements Material Design paint pipeline.

Warning: None

function enterEvent

void enterEvent(
    QEnterEvent * event
) override

Handles mouse enter event.

Parameters:

  • event Enter event.

Exceptions:

  • None

Since: 0.1

Note: Updates hover state.

Warning: None

function leaveEvent

void leaveEvent(
    QEvent * event
) override

Handles mouse leave event.

Parameters:

  • event Leave event.

Exceptions:

  • None

Since: 0.1

Note: Updates hover state.

Warning: None

function mousePressEvent

void mousePressEvent(
    QMouseEvent * event
) override

Handles mouse press event.

Parameters:

  • event Mouse event.

Exceptions:

  • None

Since: 0.1

Note: Triggers ripple and press state.

Warning: None

function mouseReleaseEvent

void mouseReleaseEvent(
    QMouseEvent * event
) override

Handles mouse release event.

Parameters:

  • event Mouse event.

Exceptions:

  • None

Since: 0.1

Note: Updates press state.

Warning: None

function focusInEvent

void focusInEvent(
    QFocusEvent * event
) override

Handles focus in event.

Parameters:

  • event Focus event.

Exceptions:

  • None

Since: 0.1

Note: Shows focus indicator.

Warning: None

function focusOutEvent

void focusOutEvent(
    QFocusEvent * event
) override

Handles focus out event.

Parameters:

  • event Focus event.

Exceptions:

  • None

Since: 0.1

Note: Hides focus indicator.

Warning: None

function changeEvent

void changeEvent(
    QEvent * event
) override

Handles widget state change event.

Parameters:

  • event Change event.

Exceptions:

  • None

Since: 0.1

Note: Updates appearance based on state changes.

Warning: None

function nextCheckState

void nextCheckState() override

Handles check state change event.

Parameters:

  • event State change event.

Exceptions:

  • None

Since: 0.1

Note: Triggers check mark animation.

Warning: None

function hitButton

bool hitButton(
    constQPoint & pos
) const override

Determines if a point is within the clickable button area.

Parameters:

  • pos The point to check, in widget coordinates.

Exceptions:

  • None

Return: true if the point is within the clickable area, false otherwise.

Since: 0.1

Note: Overrides QAbstractButton behavior to make entire widget clickable.

Warning: None

Public Property Documentation

property error

bool error;

Updated on 2026-03-09 at 10:14:00 +0000