64 QML_NAMED_ELEMENT(FABMenuBase)
65 Q_PROPERTY(
bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged FINAL)
66 Q_PROPERTY(QQuickItem* button READ button WRITE setButton NOTIFY buttonChanged FINAL)
67 Q_PROPERTY(Qt::Alignment horizontalAlignment READ horizontalAlignment WRITE
68 setHorizontalAlignment NOTIFY horizontalAlignmentChanged FINAL)
69 Q_PROPERTY(qreal buttonSpacing READ buttonSpacing WRITE setButtonSpacing NOTIFY
70 buttonSpacingChanged FINAL)
71 Q_PROPERTY(
int visibleCount READ visibleCount NOTIFY visibleCountChanged FINAL)
73 qreal revealCount READ revealCount WRITE setRevealCount NOTIFY revealCountChanged FINAL)
74 Q_PROPERTY(
bool motionEnabled READ motionEnabled NOTIFY motionEnabledChanged FINAL)
75 Q_PROPERTY(
bool sequencing READ sequencing WRITE setSequencing NOTIFY sequencingChanged FINAL)
76 Q_PROPERTY(
bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY
77 animationsEnabledChanged FINAL)
78 Q_PROPERTY(
bool transitioning READ transitioning NOTIFY transitioningChanged FINAL)
79 Q_PROPERTY(QQuickItem* viewport READ viewport CONSTANT FINAL)
81 explicit FABMenu(QQuickItem* parent =
nullptr);
83 bool expanded()
const {
return m_expanded; }
84 void setExpanded(
bool);
85 QQuickItem* button()
const {
return m_button; }
86 void setButton(QQuickItem*);
87 Qt::Alignment horizontalAlignment()
const {
return m_alignment; }
88 void setHorizontalAlignment(Qt::Alignment);
89 qreal buttonSpacing()
const {
return m_buttonSpacing; }
90 void setButtonSpacing(qreal);
91 int visibleCount()
const {
return m_visibleCount; }
92 qreal revealCount()
const {
return m_revealCount; }
93 void setRevealCount(qreal);
94 bool motionEnabled()
const {
return m_ready; }
95 bool sequencing()
const {
return m_sequencing; }
96 bool animationsEnabled()
const {
return m_animationsEnabled; }
97 void setAnimationsEnabled(
bool);
98 void setSequencing(
bool);
99 bool transitioning()
const {
return m_transitioning; }
100 QQuickItem* viewport()
const;
101 Q_INVOKABLE
void open() { setExpanded(
true); }
102 Q_INVOKABLE
void close() { setExpanded(
false); }
103 Q_INVOKABLE
void toggle() { setExpanded(! m_expanded); }
104 Q_SIGNAL
void expandedChanged();
105 Q_SIGNAL
void buttonChanged();
106 Q_SIGNAL
void horizontalAlignmentChanged();
107 Q_SIGNAL
void buttonSpacingChanged();
108 Q_SIGNAL
void visibleCountChanged();
109 Q_SIGNAL
void revealCountChanged();
110 Q_SIGNAL
void motionEnabledChanged();
111 Q_SIGNAL
void sequencingChanged();
112 Q_SIGNAL
void animationsEnabledChanged();
113 Q_SIGNAL
void transitioningChanged();
116 bool isContent(QQuickItem*)
const override;
117 void itemAdded(QQuickItem*)
override;
118 void itemRemoved(QQuickItem*)
override;
119 void updatePolish()
override;
120 bool eventFilter(QObject*, QEvent*)
override;
123 void updateTransitioning();
125 QList<FABMenuItem*> visibleItems()
const;
126 Flickable* m_viewport;
127 QPointer<QQuickItem> m_button;
128 QList<QMetaObject::Connection> m_buttonConnections;
129 QHash<QQuickItem*, QList<QMetaObject::Connection>> m_itemConnections;
130 Qt::Alignment m_alignment = Qt::AlignRight;
131 qreal m_buttonSpacing = 8;
132 qreal m_revealCount = 0;
133 int m_visibleCount = 0;
134 bool m_expanded =
false;
135 bool m_ready =
false;
136 bool m_sequencing =
false;
137 bool m_animationsEnabled =
true;
138 bool m_transitioning =
false;