11#include <QQmlIncubator>
14#include "qml_material/layout/toolbar_layout.hpp"
19class ToolBarDelegateIncubator :
public QQmlIncubator {
21 ToolBarDelegateIncubator(QQmlComponent* component, QQmlContext* context);
23 void setStateCallback(std::function<
void(QQuickItem*)> callback);
24 void setCompletedCallback(std::function<
void(ToolBarDelegateIncubator*)> callback);
31 void setInitialState(QObject*
object)
override;
32 void statusChanged(QQmlIncubator::Status status)
override;
34 QQmlComponent* m_component;
35 QQmlContext* m_context;
36 std::function<void(QQuickItem*)> m_stateCallback;
37 std::function<void(ToolBarDelegateIncubator*)> m_completedCallback;
38 bool m_finished =
false;
41class ToolBarLayoutDelegate :
public QObject {
44 ToolBarLayoutDelegate(ToolBarLayout* parent);
45 ~ToolBarLayoutDelegate()
override;
47 Action* action()
const;
48 void setAction(Action* action);
49 void createItems(QQmlComponent* fullComponent, QQmlComponent* iconComponent,
50 std::function<
void(QQuickItem*)> callback);
53 bool isActionVisible()
const;
54 bool isHidden()
const;
55 bool isIconOnly()
const;
56 bool isKeepVisible()
const;
58 bool isVisible()
const;
65 void setPosition(qreal x, qreal y);
66 void setHeight(qreal height);
71 qreal implicitWidth()
const;
72 qreal implicitHeight()
const;
73 qreal maxHeight()
const;
74 qreal iconWidth()
const;
75 qreal fullWidth()
const;
78 Q_SLOT
void actionVisibleChanged();
79 Q_SLOT
void displayHintChanged();
80 inline void ensureItemVisibility() {
82 m_full->setVisible(m_fullVisible);
85 m_icon->setVisible(m_iconVisible);
88 void cleanupIncubators();
89 void triggerRelayout();
91 ToolBarLayout* m_parent =
nullptr;
92 Action* m_action =
nullptr;
93 QQuickItem* m_full =
nullptr;
94 QQuickItem* m_icon =
nullptr;
95 ToolBarDelegateIncubator* m_fullIncubator =
nullptr;
96 ToolBarDelegateIncubator* m_iconIncubator =
nullptr;
98 ToolBarLayout::DisplayHints m_displayHint = ToolBarLayout::NoPreference;
100 bool m_actionVisible =
true;
101 bool m_fullVisible =
false;
102 bool m_iconVisible =
false;