Changeset View
Changeset View
Standalone View
Standalone View
plugins/problemreporter/actionmenu.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Anton Anikin <anton@anikin.xyz> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 of the | ||||
7 | * License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef ACTION_MENU_H | ||||
21 | #define ACTION_MENU_H | ||||
22 | | ||||
23 | #include <QWidgetAction> | ||||
24 | | ||||
25 | class QActionGroup; | ||||
26 | | ||||
27 | namespace KDevelop | ||||
28 | { | ||||
29 | | ||||
30 | class ActionMenu : public QWidgetAction | ||||
31 | { | ||||
32 | Q_OBJECT | ||||
33 | | ||||
34 | public: | ||||
35 | explicit ActionMenu(const QString& prefix, QObject* parent = nullptr); | ||||
36 | ~ActionMenu() override; | ||||
37 | | ||||
38 | QAction* addAction(const QString& text, const QString& toolTip, int id); | ||||
39 | | ||||
40 | void selectAction(int id); | ||||
41 | | ||||
42 | QWidget* createWidget(QWidget* parent) override; | ||||
43 | | ||||
44 | Q_SIGNALS: | ||||
45 | void actionSelected(int id); | ||||
46 | | ||||
47 | protected: | ||||
48 | bool eventFilter(QObject* obj, QEvent* event) override; | ||||
49 | | ||||
50 | QString m_prefix; | ||||
51 | QActionGroup* m_group; | ||||
52 | QHash<int, QAction*> m_mapper; | ||||
53 | }; | ||||
54 | | ||||
55 | } | ||||
56 | | ||||
57 | #endif |