Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmenubar_p_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKMENUBAR_P_P_H
6#define QQUICKMENUBAR_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickmenubar_p.h>
20#include <QtQuickTemplates2/private/qquickcontainer_p_p.h>
21
22#include <QtCore/qpointer.h>
23#include <QtGui/qpa/qplatformmenu.h>
24
26
27class QQmlComponent;
28class QQuickMenuBarItem;
29
30class Q_QUICKTEMPLATES2_EXPORT QQuickMenuBarPrivate : public QQuickContainerPrivate
31{
32public:
33 Q_DECLARE_PUBLIC(QQuickMenuBar)
34
35 static QQuickMenuBarPrivate *get(QQuickMenuBar *menuBar)
36 {
37 return menuBar->d_func();
38 }
39
40 QQmlListProperty<QQuickMenu> menus();
41 QQmlListProperty<QObject> contentData();
42
43 QQuickItem *createItemFromDelegate();
44 QQuickMenuBarItem *createMenuBarItem(QQuickMenu *menu);
45
46 void openCurrentMenu();
47 void closeCurrentMenu();
48 void activateMenuItem(int index);
49
50 void activateItem(QQuickMenuBarItem *item);
51 void activateNextItem();
52 void activatePreviousItem();
53
54 void onItemHovered();
55 void onItemTriggered();
56 void onMenuAboutToHide(QQuickMenu *menu);
57
58 void insertMenu(int index, QQuickMenu *menu, QQuickMenuBarItem *delegateItem);
59 QQuickMenu *takeMenu(int index);
60 void insertNativeMenu(QQuickMenu *menu);
61 void removeNativeMenu(QQuickMenu *menu);
62 void syncMenuBarItemVisibilty(QQuickMenuBarItem *menuBarItem);
63
64 QWindow *window() const;
65 int menuIndex(QQuickMenu *menu) const;
66
67 QPlatformMenuBar *nativeHandle() const;
68 bool useNativeMenuBar() const;
69 bool useNativeMenu(const QQuickMenu *menu) const;
70 void syncNativeMenuBarVisible();
71 void createNativeMenuBar();
72 void removeNativeMenuBar();
73
74 qreal getContentWidth() const override;
75 qreal getContentHeight() const override;
76
77 void itemImplicitWidthChanged(QQuickItem *item) override;
78 void itemImplicitHeightChanged(QQuickItem *item) override;
79
80 static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
81
82 static void menus_append(QQmlListProperty<QQuickMenu> *prop, QQuickMenu *obj);
83 static qsizetype menus_count(QQmlListProperty<QQuickMenu> *prop);
84 static QQuickMenu *menus_at(QQmlListProperty<QQuickMenu> *prop, qsizetype index);
85 static void menus_clear(QQmlListProperty<QQuickMenu> *prop);
86
87 QPalette defaultPalette() const override;
88
89 bool closingCurrentMenu = false;
90 bool altPressed = false;
91 bool currentMenuOpen = false;
92 QQmlComponent *delegate = nullptr;
93 QPointer<QQuickMenuBarItem> currentItem;
94 QPointer<QQuickItem> windowContentItem;
95
96private:
97 std::unique_ptr<QPlatformMenuBar> handle;
98};
99
100QT_END_NAMESPACE
101
102#endif // QQUICKMENUBAR_P_P_H
QT_REQUIRE_CONFIG(quicktemplates2_container)