Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
button_taskmenu.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5#ifndef BUTTON_TASKMENU_H
6#define BUTTON_TASKMENU_H
7
8#include <QtWidgets/qabstractbutton.h>
9#include <QtWidgets/qcommandlinkbutton.h>
10#include <QtWidgets/qbuttongroup.h>
11
12#include <qdesigner_taskmenu_p.h>
13#include <extensionfactory_p.h>
14
16
17class QMenu;
18class QActionGroup;
19class QDesignerFormWindowCursorInterface;
20
21namespace qdesigner_internal {
22
23// ButtonGroupMenu: Mixin menu for the 'select members'/'break group' options of
24// the task menu of buttons and button group
26{
27 Q_OBJECT
28 Q_DISABLE_COPY_MOVE(ButtonGroupMenu)
29public:
30 ButtonGroupMenu(QObject *parent = nullptr);
31
32 void initialize(QDesignerFormWindowInterface *formWindow,
33 QButtonGroup *buttonGroup = nullptr,
34 /* Current button for selection in ButtonMode */
35 QAbstractButton *currentButton = nullptr);
36
37 QAction *selectGroupAction() const { return m_selectGroupAction; }
38 QAction *breakGroupAction() const { return m_breakGroupAction; }
39
40private slots:
41 void selectGroup();
42 void breakGroup();
43
44private:
45 QAction *m_selectGroupAction;
46 QAction *m_breakGroupAction;
47
48 QDesignerFormWindowInterface *m_formWindow = nullptr;
49 QButtonGroup *m_buttonGroup = nullptr;
50 QAbstractButton *m_currentButton = nullptr;
51};
52
53// Task menu extension of a QButtonGroup
55{
56 Q_OBJECT
57 Q_DISABLE_COPY_MOVE(ButtonGroupTaskMenu)
59public:
61
62 QAction *preferredEditAction() const override;
63 QList<QAction*> taskActions() const override;
64
65private:
66 QButtonGroup *m_buttonGroup;
67 QList<QAction*> m_taskActions;
68 mutable ButtonGroupMenu m_menu;
69};
70
71// Task menu extension of a QAbstractButton
73{
74 Q_OBJECT
75 Q_DISABLE_COPY_MOVE(ButtonTaskMenu)
76public:
77 explicit ButtonTaskMenu(QAbstractButton *button, QObject *parent = nullptr);
79
80 QAction *preferredEditAction() const override;
81 QList<QAction*> taskActions() const override;
82
83 QAbstractButton *button() const;
84
85protected:
86 void insertAction(int index, QAction *a);
87
88private slots:
89 void createGroup();
90 void addToGroup(QAction *a);
91 void removeFromGroup();
92
93private:
94 enum SelectionType {
95 OtherSelection,
96 UngroupedButtonSelection,
97 GroupedButtonSelection
98 };
99
100 SelectionType selectionType(const QDesignerFormWindowCursorInterface *cursor, QButtonGroup ** ptrToGroup = nullptr) const;
101 bool refreshAssignMenu(const QDesignerFormWindowInterface *fw, int buttonCount, SelectionType st, QButtonGroup *currentGroup);
102 QMenu *createGroupSelectionMenu(const QDesignerFormWindowInterface *fw);
103
104 QList<QAction*> m_taskActions;
105 mutable ButtonGroupMenu m_groupMenu;
106 QMenu *m_assignGroupSubMenu;
107 QActionGroup *m_assignActionGroup;
108 QAction *m_assignToGroupSubMenuAction;
109 QMenu *m_currentGroupSubMenu;
110 QAction *m_currentGroupSubMenuAction;
111
112 QAction *m_createGroupAction;
113 QAction *m_preferredEditAction;
114 QAction *m_removeFromGroupAction;
115};
116
117// Task menu extension of a QCommandLinkButton
119{
120 Q_OBJECT
121 Q_DISABLE_COPY_MOVE(CommandLinkButtonTaskMenu)
122public:
124};
125
129} // namespace qdesigner_internal
130
131QT_END_NAMESPACE
132
133#endif // BUTTON_TASKMENU_H
void init(const ButtonList &bl, QButtonGroup *group)
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
AddButtonsToGroupCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
BreakButtonGroupCommand(QDesignerFormWindowInterface *formWindow)
ButtonGroupCommand(const QString &description, QDesignerFormWindowInterface *formWindow)
static ButtonGroupList managedButtonGroups(const QDesignerFormWindowInterface *formWindow)
void initialize(const ButtonList &bl, QButtonGroup *buttonGroup)
static QString nameList(const ButtonList &bl)
void initialize(QDesignerFormWindowInterface *formWindow, QButtonGroup *buttonGroup=nullptr, QAbstractButton *currentButton=nullptr)
QAction * preferredEditAction() const override
QList< QAction * > taskActions() const override
QAction * preferredEditAction() const override
void insertAction(int index, QAction *a)
QList< QAction * > taskActions() const override
ButtonTextTaskMenuInlineEditor(QAbstractButton *button, QObject *parent)
void redo() override
Applies a change to the document.
CreateButtonGroupCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
LinkDescriptionTaskMenuInlineEditor(QAbstractButton *button, QObject *parent)
RemoveButtonsFromGroupCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static ButtonList buttonList(const QDesignerFormWindowCursorInterface *cursor)
static QUndoCommand * createRemoveButtonsCommand(QDesignerFormWindowInterface *fw, const ButtonList &bl)