QmlMaterial 0.1.0
Loading...
Searching...
No Matches
tab_button_state.hpp
1#pragma once
2#include "qml_material/style/button_interaction_state.hpp"
3Q_MOC_INCLUDE("qml_material/control/tab_button.hpp")
4namespace qml_material
5{
6class TabButton;
7class QML_MATERIAL_API TabButtonState : public ButtonInteractionState {
8 Q_OBJECT
9 QML_NAMED_ELEMENT(StateTabButton)
10 Q_PROPERTY(qml_material::TabButton* item READ item WRITE setItem NOTIFY itemChanged FINAL)
11 Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged BINDABLE bindableType FINAL)
12 Q_PROPERTY(QColor baseTextColor READ baseTextColor WRITE setBaseTextColor RESET
13 resetBaseTextColor NOTIFY baseTextColorChanged BINDABLE bindableBaseTextColor)
14public:
15 explicit TabButtonState(QObject* parent = nullptr);
16 TabButton* item() const;
17 void setItem(TabButton*);
18 int type() const;
19 void setType(int);
20 QBindable<int> bindableType();
21 QColor baseTextColor() const;
22 void setBaseTextColor(const QColor&);
23 Q_INVOKABLE void resetBaseTextColor();
24 QBindable<QColor> bindableBaseTextColor();
25 Q_SIGNAL void typeChanged();
26 Q_SIGNAL void baseTextColorChanged();
27
28private:
29 Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(TabButtonState, int, m_type,
30 int(Enum::TabType::PrimaryTab),
31 &TabButtonState::typeChanged)
32 Q_OBJECT_BINDABLE_PROPERTY(TabButtonState, QColor, m_baseTextColor,
33 &TabButtonState::baseTextColorChanged)
34 BindingLifetime m_bindingLifetime { bindingSet().lifetime() };
35};
36} // namespace qml_material