1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef BUTTON_TASKMENU_H |
30 | #define |
31 | |
32 | #include <QtWidgets/qabstractbutton.h> |
33 | #include <QtWidgets/qcommandlinkbutton.h> |
34 | #include <QtWidgets/qbuttongroup.h> |
35 | |
36 | #include <qdesigner_taskmenu_p.h> |
37 | #include <extensionfactory_p.h> |
38 | |
39 | QT_BEGIN_NAMESPACE |
40 | |
41 | class ; |
42 | class QActionGroup; |
43 | class QDesignerFormWindowCursorInterface; |
44 | |
45 | namespace qdesigner_internal { |
46 | |
47 | // ButtonGroupMenu: Mixin menu for the 'select members'/'break group' options of |
48 | // the task menu of buttons and button group |
49 | class : public QObject |
50 | { |
51 | Q_OBJECT |
52 | Q_DISABLE_COPY_MOVE() |
53 | public: |
54 | (QObject *parent = nullptr); |
55 | |
56 | void (QDesignerFormWindowInterface *formWindow, |
57 | QButtonGroup *buttonGroup = nullptr, |
58 | /* Current button for selection in ButtonMode */ |
59 | QAbstractButton *currentButton = nullptr); |
60 | |
61 | QAction *() const { return m_selectGroupAction; } |
62 | QAction *() const { return m_breakGroupAction; } |
63 | |
64 | private slots: |
65 | void (); |
66 | void (); |
67 | |
68 | private: |
69 | QAction *; |
70 | QAction *; |
71 | |
72 | QDesignerFormWindowInterface * = nullptr; |
73 | QButtonGroup * = nullptr; |
74 | QAbstractButton * = nullptr; |
75 | }; |
76 | |
77 | // Task menu extension of a QButtonGroup |
78 | class : public QObject, public QDesignerTaskMenuExtension |
79 | { |
80 | Q_OBJECT |
81 | Q_DISABLE_COPY_MOVE() |
82 | Q_INTERFACES(QDesignerTaskMenuExtension) |
83 | public: |
84 | explicit (QButtonGroup *buttonGroup, QObject *parent = nullptr); |
85 | |
86 | QAction *() const override; |
87 | QList<QAction*> () const override; |
88 | |
89 | private: |
90 | QButtonGroup *; |
91 | QList<QAction*> ; |
92 | mutable ButtonGroupMenu ; |
93 | }; |
94 | |
95 | // Task menu extension of a QAbstractButton |
96 | class : public QDesignerTaskMenu |
97 | { |
98 | Q_OBJECT |
99 | Q_DISABLE_COPY_MOVE() |
100 | public: |
101 | explicit (QAbstractButton *button, QObject *parent = nullptr); |
102 | () override; |
103 | |
104 | QAction *() const override; |
105 | QList<QAction*> () const override; |
106 | |
107 | QAbstractButton *() const; |
108 | |
109 | protected: |
110 | void (int index, QAction *a); |
111 | |
112 | private slots: |
113 | void (); |
114 | void (QAction *a); |
115 | void (); |
116 | |
117 | private: |
118 | enum { |
119 | , |
120 | , |
121 | |
122 | }; |
123 | |
124 | SelectionType (const QDesignerFormWindowCursorInterface *cursor, QButtonGroup ** ptrToGroup = nullptr) const; |
125 | bool (const QDesignerFormWindowInterface *fw, int buttonCount, SelectionType st, QButtonGroup *currentGroup); |
126 | QMenu *(const QDesignerFormWindowInterface *fw); |
127 | |
128 | QList<QAction*> ; |
129 | mutable ButtonGroupMenu ; |
130 | QMenu *; |
131 | QActionGroup *; |
132 | QAction *; |
133 | QMenu *; |
134 | QAction *; |
135 | |
136 | QAction *; |
137 | QAction *; |
138 | QAction *; |
139 | }; |
140 | |
141 | // Task menu extension of a QCommandLinkButton |
142 | class CommandLinkButtonTaskMenu: public ButtonTaskMenu |
143 | { |
144 | Q_OBJECT |
145 | Q_DISABLE_COPY_MOVE(CommandLinkButtonTaskMenu) |
146 | public: |
147 | explicit CommandLinkButtonTaskMenu(QCommandLinkButton *button, QObject *parent = nullptr); |
148 | }; |
149 | |
150 | using = ExtensionFactory<QDesignerTaskMenuExtension, QButtonGroup, ButtonGroupTaskMenu>; |
151 | using CommandLinkButtonTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QCommandLinkButton, CommandLinkButtonTaskMenu>; |
152 | using = ExtensionFactory<QDesignerTaskMenuExtension, QAbstractButton, ButtonTaskMenu>; |
153 | } // namespace qdesigner_internal |
154 | |
155 | QT_END_NAMESPACE |
156 | |
157 | #endif // BUTTON_TASKMENU_H |
158 | |