forked from GLDsuh-a/qt-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custommenu.h
48 lines (37 loc) · 838 Bytes
/
custommenu.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
#ifndef CUSTOMMENU_H
#define CUSTOMMENU_H
#include <QMenu>
#include <QWidget>
class TestDialog : public QWidget
{
Q_OBJECT
public:
explicit TestDialog (QWidget *parent = 0);
~TestDialog ();
protected:
void contextMenuEvent(QContextMenuEvent *event);
};
/**
* @brief ¶¨ÖÆ»¯µÄQMenu
*/
class CCustomMenu : public QMenu
{
Q_OBJECT
public:
explicit CCustomMenu(const QString &title, QWidget *parent = 0);
explicit CCustomMenu(QWidget *parent = 0);
~CCustomMenu();
/**
* @brief ÖØдQMenu::addmenu
* @param menu
* @return
*/
QAction *addMenu(CCustomMenu *menu);
CCustomMenu *addMenu(const QString &title);
CCustomMenu *addMenu(const QIcon &icon, const QString &title);
protected:
bool event(QEvent *event);
private:
void init();
};
#endif // CUSTOMMENU_H