-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatformmenu.h
85 lines (69 loc) · 2.08 KB
/
platformmenu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef PLATFORMMENU_H
#define PLATFORMMENU_H
#include <qpa/qplatformmenu.h>
#include <QList>
#include <QWidget>
class PlatformMenu : public QPlatformMenu
{
Q_OBJECT
public:
void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before);
void removeMenuItem(QPlatformMenuItem *menuItem);
void syncMenuItem(QPlatformMenuItem *menuItem);
void syncSeparatorsCollapsible(bool enable);
void setTag(quintptr tag);
quintptr tag() const;
void setText(const QString &text);
void setIcon(const QIcon &icon);
void setEnabled(bool enabled);
bool isEnabled() const;
void setVisible(bool visible);
void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item);
QPlatformMenuItem *menuItemAt(int position) const;
QPlatformMenuItem *menuItemForTag(quintptr tag) const;
signals:
public slots:
private:
QList<QPlatformMenuItem*> menuItems;
quintptr tg;
QString tx;
QIcon ic;
bool en;
bool vis;
};
class PlatformMenuBar : public QPlatformMenuBar
{
Q_OBJECT
public:
PlatformMenuBar();
void insertMenu(QPlatformMenu *menu, QPlatformMenu *before);
void removeMenu(QPlatformMenu *menu);
void syncMenu(QPlatformMenu *menuItem);
void handleReparent(QWindow *newParentWindow);
QPlatformMenu *menuForTag(quintptr tag) const;
QPlatformMenu *createMenu() const;
private:
QList<QPlatformMenu*> menuItems;
QWindow* parentWindow;
QWidget* widget;
};
class PlatformMenuItem : public QPlatformMenuItem
{
Q_OBJECT
public:
void setTag(quintptr tag);
quintptr tag() const;
void setText(const QString &text);
void setIcon(const QIcon &icon);
void setMenu(QPlatformMenu *menu);
void setVisible(bool isVisible);
void setIsSeparator(bool isSeparator);
void setFont(const QFont &font);
void setRole(MenuRole role);
void setCheckable(bool checkable);
void setChecked(bool isChecked);
void setShortcut(const QKeySequence& shortcut);
void setEnabled(bool enabled);
void setIconSize(int size);
};
#endif // PLATFORMMENU_H