1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKMENUBAR_P_P_H
5#define QQUICKMENUBAR_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickmenubar_p.h>
19#include <QtQuickTemplates2/private/qquickcontainer_p_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQmlComponent;
24class QQuickMenuBarItem;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuBarPrivate : public QQuickContainerPrivate
27{
28public:
29 Q_DECLARE_PUBLIC(QQuickMenuBar)
30
31 static QQuickMenuBarPrivate *get(QQuickMenuBar *menuBar)
32 {
33 return menuBar->d_func();
34 }
35
36 QQmlListProperty<QQuickMenu> menus();
37 QQmlListProperty<QObject> contentData();
38
39 QQuickItem *beginCreateItem(QQuickMenu *menu);
40 void completeCreateItem();
41
42 QQuickItem *createItem(QQuickMenu *menu);
43
44 void toggleCurrentMenu(bool visible, bool activate);
45 void activateItem(QQuickMenuBarItem *item);
46 void activateNextItem();
47 void activatePreviousItem();
48
49 void onItemHovered();
50 void onItemTriggered();
51 void onMenuAboutToHide();
52
53 qreal getContentWidth() const override;
54 qreal getContentHeight() const override;
55
56 void itemImplicitWidthChanged(QQuickItem *item) override;
57 void itemImplicitHeightChanged(QQuickItem *item) override;
58
59 static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
60
61 static void menus_append(QQmlListProperty<QQuickMenu> *prop, QQuickMenu *obj);
62 static qsizetype menus_count(QQmlListProperty<QQuickMenu> *prop);
63 static QQuickMenu *menus_at(QQmlListProperty<QQuickMenu> *prop, qsizetype index);
64 static void menus_clear(QQmlListProperty<QQuickMenu> *prop);
65
66 QPalette defaultPalette() const override;
67
68 bool popupMode = false;
69 bool triggering = false;
70 bool altPressed = false;
71 QQmlComponent *delegate = nullptr;
72 QPointer<QQuickMenuBarItem> currentItem;
73 QPointer<QQuickItem> windowContentItem;
74};
75
76QT_END_NAMESPACE
77
78#endif // QQUICKMENUBAR_P_P_H
79

source code of qtdeclarative/src/quicktemplates/qquickmenubar_p_p.h