跳转至

cf::ui::widget::material::base::StateMachine

Material Design state machine. More...

#include <state_machine.h>

Inherits from QObject

Public Types

Name
enum class State { StateNormal = 0x00, StateHovered = 0x01, StatePressed = 0x02, StateFocused = 0x04, StateDisabled = 0x08, StateChecked = 0x10, StateDragged = 0x20}
Widget interaction states.

Public Signals

Name
void stateChanged(States newState, States oldState)
Signal emitted when state changes.
void stateLayerOpacityChanged(float opacity)
Signal emitted when state layer opacity changes.

Public Functions

Name
StateMachine(cf::WeakPtr< components::material::CFMaterialAnimationFactory > factory, QObject * parent)
Constructor with animation factory.
void onHoverEnter()
Handles hover enter event.
void onHoverLeave()
Handles hover leave event.
void onPress(constQPoint & pos)
Handles press event.
void onRelease()
Handles release event.
void onFocusIn()
Handles focus in event.
void onFocusOut()
Handles focus out event.
void onEnable()
Handles enable event.
void onDisable()
Handles disable event.
void onCheckedChanged(bool checked)
Handles checked state change event.
~StateMachine()
Destructor.
States currentState() const
Gets the current states.
bool hasState(State s) const
Checks if a specific state is active.
float stateLayerOpacity() const
Gets the state layer opacity.

Detailed Description

class cf::ui::widget::material::base::StateMachine;

Material Design state machine.

Since: N/A

Manages Material Design widget states including hover, pressed, focused, disabled, and checked states with animated state layer transitions.

Public Types Documentation

enum State

Enumerator Value Description
StateNormal 0x00 Normal state.
StateHovered 0x01 Mouse hover state.
StatePressed 0x02 Mouse pressed state.
StateFocused 0x04 Keyboard focused state.
StateDisabled 0x08 Disabled state.
StateChecked 0x10 Checked state.
StateDragged 0x20 Dragged state.

Widget interaction states.

Since: N/A

Public Signals Documentation

signal stateChanged

void stateChanged(
    States newState,
    States oldState
)

Signal emitted when state changes.

Parameters:

  • newState New widget states.
  • oldState Previous widget states.

Since: N/A

signal stateLayerOpacityChanged

void stateLayerOpacityChanged(
    float opacity
)

Signal emitted when state layer opacity changes.

Parameters:

  • opacity New opacity value.

Since: N/A

Public Functions Documentation

function StateMachine

explicit StateMachine(
    cf::WeakPtr< components::material::CFMaterialAnimationFactory > factory,
    QObject * parent
)

Constructor with animation factory.

Parameters:

  • factory WeakPtr to the animation factory.
  • parent QObject parent.
  • factory WeakPtr to animation factory for creating transitions.
  • parent QObject parent for memory management.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

Constructor - initializes state machine with animation factory.

function onHoverEnter

void onHoverEnter()

Handles hover enter event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onHoverLeave

void onHoverLeave()

Handles hover leave event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onPress

void onPress(
    constQPoint & pos
)

Handles press event.

Parameters:

  • pos Press position coordinates.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onRelease

void onRelease()

Handles release event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onFocusIn

void onFocusIn()

Handles focus in event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onFocusOut

void onFocusOut()

Handles focus out event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onEnable

void onEnable()

Handles enable event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onDisable

void onDisable()

Handles disable event.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function onCheckedChanged

void onCheckedChanged(
    bool checked
)

Handles checked state change event.

Parameters:

  • checked true if widget is checked, false otherwise.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

function ~StateMachine

~StateMachine()

Destructor.

Exceptions:

  • None

Since: N/A

Note: None

Warning: None

Destructor - cancels any running animation.

Cancels any running animation before destruction.

function currentState

States currentState() const

Gets the current states.

Exceptions:

  • None

Return: Current widget states.

Since: N/A

Note: None

Warning: None

function hasState

bool hasState(
    State s
) const

Checks if a specific state is active.

Parameters:

  • s State to check.

Exceptions:

  • None

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

Since: N/A

Note: None

Warning: None

function stateLayerOpacity

float stateLayerOpacity() const

Gets the state layer opacity.

Exceptions:

  • None

Return: Current state layer opacity (0.0 to 1.0).

Since: N/A

Note: Used for Material Design state overlay rendering.

Warning: None


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