1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2006 Olivier Goffart <ogoffart@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef kmenumenuhandler_p_h |
9 | #define kmenumenuhandler_p_h |
10 | |
11 | #include <QObject> |
12 | |
13 | class QAction; |
14 | class ; |
15 | |
16 | class KXMLGUIBuilder; |
17 | class KSelectAction; |
18 | |
19 | namespace KDEPrivate |
20 | { |
21 | /** |
22 | * @internal |
23 | * This class handle the context menu of QMenu. |
24 | * Used by KXmlGuiBuilder |
25 | * @author Olivier Goffart <ogoffart@kde.org> |
26 | */ |
27 | class KMenuMenuHandler : public QObject |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | explicit KMenuMenuHandler(KXMLGUIBuilder *b); |
32 | ~KMenuMenuHandler() override |
33 | { |
34 | } |
35 | void insertMenu(QMenu *); |
36 | bool eventFilter(QObject *watched, QEvent *event) override; |
37 | |
38 | private Q_SLOTS: |
39 | void slotSetShortcut(); |
40 | void buildToolbarAction(); |
41 | void slotAddToToolBar(int); |
42 | |
43 | private: |
44 | void showContextMenu(QMenu *, const QPoint &pos); |
45 | |
46 | KXMLGUIBuilder *m_builder = nullptr; |
47 | KSelectAction *m_toolbarAction = nullptr; |
48 | QMenu *m_popupMenu = nullptr; |
49 | QAction *m_popupAction = nullptr; |
50 | QMenu *m_contextMenu = nullptr; |
51 | }; |
52 | |
53 | } // END namespace KDEPrivate |
54 | |
55 | #endif |
56 | |