2#include "qml_material/style/button_interaction_state.hpp"
3Q_MOC_INCLUDE(
"qml_material/control/button_control.hpp")
6class QML_MATERIAL_API MenuItemState :
public ButtonInteractionState {
8 QML_NAMED_ELEMENT(StateMenuItem)
9 Q_PROPERTY(qml_material::ButtonControl* item READ item WRITE setItem NOTIFY itemChanged FINAL)
10 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectedChanged BINDABLE
11 bindableSelected FINAL)
12 Q_PROPERTY(
bool expressive READ expressive WRITE setExpressive NOTIFY expressiveChanged FINAL)
13 Q_PROPERTY(
bool vibrant READ vibrant WRITE setVibrant NOTIFY vibrantChanged FINAL)
14 Q_PROPERTY(QColor leadingIconColor READ leadingIconColor WRITE setLeadingIconColor RESET
15 resetLeadingIconColor NOTIFY leadingIconColorChanged BINDABLE
16 bindableLeadingIconColor FINAL)
17 Q_PROPERTY(QColor trailingIconColor READ trailingIconColor WRITE setTrailingIconColor RESET
18 resetTrailingIconColor NOTIFY trailingIconColorChanged BINDABLE
19 bindableTrailingIconColor FINAL)
21 explicit MenuItemState(QObject* parent =
nullptr);
22 ButtonControl* item()
const;
23 void setItem(ButtonControl*);
24 bool selected()
const;
25 void setSelected(
bool);
26 QBindable<bool> bindableSelected();
27 bool expressive()
const {
return m_expressive; }
28 void setExpressive(
bool value) { m_expressive = value; }
29 bool vibrant()
const {
return m_vibrant; }
30 void setVibrant(
bool value) { m_vibrant = value; }
31 QColor leadingIconColor()
const;
32 void setLeadingIconColor(
const QColor&);
33 Q_INVOKABLE
void resetLeadingIconColor();
34 QBindable<QColor> bindableLeadingIconColor();
35 QColor trailingIconColor()
const;
36 void setTrailingIconColor(
const QColor&);
37 Q_INVOKABLE
void resetTrailingIconColor();
38 QBindable<QColor> bindableTrailingIconColor();
39 Q_SIGNAL
void selectedChanged();
40 Q_SIGNAL
void expressiveChanged();
41 Q_SIGNAL
void vibrantChanged();
42 Q_SIGNAL
void leadingIconColorChanged();
43 Q_SIGNAL
void trailingIconColorChanged();
46 Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(MenuItemState,
bool, m_selected,
false,
47 &MenuItemState::selectedChanged)
48 Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(MenuItemState,
bool, m_expressive,
true,
49 &MenuItemState::expressiveChanged)
50 Q_OBJECT_BINDABLE_PROPERTY(MenuItemState,
bool, m_vibrant, &MenuItemState::vibrantChanged)
51 Q_OBJECT_BINDABLE_PROPERTY(MenuItemState, QColor, m_leadingIconColor,
52 &MenuItemState::leadingIconColorChanged)
53 Q_OBJECT_BINDABLE_PROPERTY(MenuItemState, QColor, m_trailingIconColor,
54 &MenuItemState::trailingIconColorChanged)
55 PropertyKey<QColor> m_leadingKey, m_trailingKey;
56 BindingLifetime m_bindingLifetime { bindingSet().lifetime() };