2#include "qml_material/style/button_interaction_state.hpp"
3Q_MOC_INCLUDE(
"qml_material/control/switch.hpp")
7class QML_MATERIAL_API SwitchState :
public ButtonInteractionState {
9 QML_NAMED_ELEMENT(StateSwitch)
10 Q_PROPERTY(qml_material::Switch* item READ item WRITE setItem NOTIFY itemChanged FINAL)
11 Q_PROPERTY(QColor handleColor READ handleColor WRITE setHandleColor RESET resetHandleColor
12 NOTIFY handleColorChanged BINDABLE bindableHandleColor)
13 Q_PROPERTY(
int handleSize READ handleSize WRITE setHandleSize RESET resetHandleSize NOTIFY
14 handleSizeChanged BINDABLE bindableHandleSize)
15 Q_PROPERTY(
bool hasIcon READ hasIcon NOTIFY hasIconChanged)
17 explicit SwitchState(QObject* parent =
nullptr);
19 void setItem(Switch*);
20 QColor handleColor()
const;
21 void setHandleColor(
const QColor&);
22 void resetHandleColor();
23 QBindable<QColor> bindableHandleColor();
24 int handleSize()
const;
25 void setHandleSize(
int);
26 void resetHandleSize();
27 QBindable<int> bindableHandleSize();
29 Q_SIGNAL
void handleColorChanged();
30 Q_SIGNAL
void handleSizeChanged();
31 Q_SIGNAL
void hasIconChanged();
34 PropertyKey<QColor> m_handleColorKey;
35 PropertyKey<int> m_handleSizeKey;
36 Q_OBJECT_BINDABLE_PROPERTY(SwitchState, QColor, m_handleColor, &SwitchState::handleColorChanged)
37 Q_OBJECT_BINDABLE_PROPERTY(SwitchState,
int, m_handleSize, &SwitchState::handleSizeChanged)
38 Q_OBJECT_BINDABLE_PROPERTY(SwitchState,
bool, m_hasIcon, &SwitchState::hasIconChanged)
39 BindingLifetime m_bindingLifetime { bindingSet().lifetime() };