QmlMaterial 0.1.0
Loading...
Searching...
No Matches
radio_button_state.hpp
1#pragma once
2#include "qml_material/style/button_interaction_state.hpp"
3Q_MOC_INCLUDE("qml_material/control/radio_button.hpp")
4namespace qml_material
5{
6class RadioButton;
7class QML_MATERIAL_API RadioButtonState : public ButtonInteractionState {
8 Q_OBJECT
9 QML_NAMED_ELEMENT(StateRadioButton)
10 Q_PROPERTY(qml_material::RadioButton* item READ item WRITE setItem NOTIFY itemChanged FINAL)
11 Q_PROPERTY(QColor iconColor READ iconColor WRITE setIconColor RESET resetIconColor NOTIFY
12 iconColorChanged BINDABLE bindableIconColor FINAL)
13
14public:
15 explicit RadioButtonState(QObject* parent = nullptr);
16 RadioButton* item() const;
17 void setItem(RadioButton*);
18 QColor iconColor() const;
19 void setIconColor(const QColor&);
20 QBindable<QColor> bindableIconColor();
21 Q_INVOKABLE void resetIconColor();
22 Q_SIGNAL void iconColorChanged();
23
24private:
25 PropertyKey<QColor> m_iconKey;
26 Q_OBJECT_BINDABLE_PROPERTY(RadioButtonState, QColor, m_iconColor,
27 &RadioButtonState::iconColorChanged)
28 BindingLifetime m_bindingLifetime { bindingSet().lifetime() };
29};
30} // namespace qml_material