11#include <QQmlIncubator>
14#include "qml_material/layout/toolbar_layout.hpp"
19class ToolBarDelegateIncubator :
public QQmlIncubator
22 ToolBarDelegateIncubator(QQmlComponent *component, QQmlContext *context);
24 void setStateCallback(std::function<
void(QQuickItem *)> callback);
25 void setCompletedCallback(std::function<
void(ToolBarDelegateIncubator *)> callback);
32 void setInitialState(QObject *
object)
override;
33 void statusChanged(QQmlIncubator::Status status)
override;
35 QQmlComponent *m_component;
36 QQmlContext *m_context;
37 std::function<void(QQuickItem *)> m_stateCallback;
38 std::function<void(ToolBarDelegateIncubator *)> m_completedCallback;
39 bool m_finished =
false;
42class ToolBarLayoutDelegate :
public QObject
46 ToolBarLayoutDelegate(ToolBarLayout *parent);
47 ~ToolBarLayoutDelegate()
override;
49 QObject *action()
const;
50 void setAction(QObject *action);
51 void createItems(QQmlComponent *fullComponent, QQmlComponent *iconComponent, std::function<
void(QQuickItem *)> callback);
54 bool isActionVisible()
const;
55 bool isHidden()
const;
56 bool isIconOnly()
const;
57 bool isKeepVisible()
const;
59 bool isVisible()
const;
66 void setPosition(qreal x, qreal y);
67 void setHeight(qreal height);
72 qreal implicitWidth()
const;
73 qreal implicitHeight()
const;
74 qreal maxHeight()
const;
75 qreal iconWidth()
const;
76 qreal fullWidth()
const;
79 Q_SLOT
void actionVisibleChanged();
80 Q_SLOT
void displayHintChanged();
81 inline void ensureItemVisibility()
84 m_full->setVisible(m_fullVisible);
87 m_icon->setVisible(m_iconVisible);
90 void cleanupIncubators();
91 void triggerRelayout();
93 ToolBarLayout *m_parent =
nullptr;
94 QObject *m_action =
nullptr;
95 QQuickItem *m_full =
nullptr;
96 QQuickItem *m_icon =
nullptr;
97 ToolBarDelegateIncubator *m_fullIncubator =
nullptr;
98 ToolBarDelegateIncubator *m_iconIncubator =
nullptr;
100 ToolBarLayout::DisplayHints m_displayHint = ToolBarLayout::NoPreference;
101 bool m_ready =
false;
102 bool m_actionVisible =
true;
103 bool m_fullVisible =
false;
104 bool m_iconVisible =
false;