Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickmenu_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
4#ifndef QQUICKMENU_P_P_H
5#define QQUICKMENU_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 <QtCore/qlist.h>
19#include <QtCore/qpointer.h>
20
21#include <QtQuickTemplates2/private/qquickmenu_p.h>
22#include <QtQuickTemplates2/private/qquickpopup_p_p.h>
23
25
26class QQuickAction;
27class QQmlComponent;
28class QQmlObjectModel;
29class QQuickMenuItem;
30
31class Q_QUICKTEMPLATES2_EXPORT QQuickMenuPrivate : public QQuickPopupPrivate
32{
33public:
34 Q_DECLARE_PUBLIC(QQuickMenu)
35
37
39 {
40 return menu->d_func();
41 }
42
43 void init();
44
45 QQuickItem *itemAt(int index) const;
46 void insertItem(int index, QQuickItem *item);
47 void moveItem(int from, int to);
48 void removeItem(int index, QQuickItem *item);
49
50 QQuickItem *beginCreateItem();
51 void completeCreateItem();
52
53 QQuickItem *createItem(QQuickMenu *menu);
54 QQuickItem *createItem(QQuickAction *action);
55
56 void resizeItem(QQuickItem *item);
57 void resizeItems();
58
59 void itemChildAdded(QQuickItem *item, QQuickItem *child) override;
60 void itemSiblingOrderChanged(QQuickItem *item) override;
61 void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
62 void itemDestroyed(QQuickItem *item) override;
63 void itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &diff) override;
64
65 QQuickPopupPositioner *getPositioner() override;
66 bool prepareEnterTransition() override;
67 bool prepareExitTransition() override;
68 bool blockInput(QQuickItem *item, const QPointF &point) const override;
69
70 void onItemHovered();
71 void onItemTriggered();
72 void onItemActiveFocusChanged();
73
74 QQuickMenu *currentSubMenu() const;
75 void setParentMenu(QQuickMenu *parent);
76 void resolveParentItem();
77
78 void propagateKeyEvent(QKeyEvent *event);
79
80 void startHoverTimer();
81 void stopHoverTimer();
82
83 void setCurrentIndex(int index, Qt::FocusReason reason);
84 bool activateNextItem();
85 bool activatePreviousItem();
86
87 QQuickMenuItem *firstEnabledMenuItem() const;
88
89 static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
90 static qsizetype contentData_count(QQmlListProperty<QObject> *prop);
91 static QObject *contentData_at(QQmlListProperty<QObject> *prop, qsizetype index);
92 static void contentData_clear(QQmlListProperty<QObject> *prop);
93
94 QPalette defaultPalette() const override;
95
96 bool cascade = false;
97 int hoverTimer = 0;
98 int currentIndex = -1;
99 qreal overlap = 0;
100 QPointer<QQuickMenu> parentMenu;
101 QPointer<QQuickMenuItem> currentItem;
102 QQuickItem *contentItem = nullptr; // TODO: cleanup
103 QList<QObject *> contentData;
105 QQmlComponent *delegate = nullptr;
108};
109
111
112#endif // QQUICKMENU_P_P_H
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtCore
Definition qobject.h:103
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQmlComponent class encapsulates a QML component definition.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
QQmlObjectModel * contentModel
QList< QObject * > contentData
QPointer< QQuickMenu > parentMenu
QPointer< QQuickMenuItem > currentItem
static QQuickMenuPrivate * get(QQuickMenu *menu)
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
FocusReason
GLuint index
[2]
struct _cl_event * event
GLhandleARB obj
[2]
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
ptrdiff_t qsizetype
Definition qtypes.h:165
double qreal
Definition qtypes.h:187
QGraphicsItem * item
QLayoutItem * child
[0]
QMenu menu
[5]