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
menutaskmenu.cpp
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
#
include
"menutaskmenu.h"
6
7
#
include
<
promotiontaskmenu_p
.
h
>
8
9
#
include
<
QtGui
/
qaction
.
h
>
10
11
#
include
<
QtCore
/
qdebug
.
h
>
12
13
QT_BEGIN_NAMESPACE
14
15
namespace
qdesigner_internal
{
16
// ------------ MenuTaskMenu
17
MenuTaskMenu
::MenuTaskMenu(QDesignerMenu *menu, QObject *parent) :
18
QObject(parent),
19
m_menu(menu),
20
m_removeAction(
new
QAction(tr(
"Remove"
),
this
)),
21
m_promotionTaskMenu(
new
PromotionTaskMenu(menu, PromotionTaskMenu::ModeSingleWidget,
this
))
22
{
23
connect(m_removeAction, &QAction::triggered,
this
, &MenuTaskMenu::removeMenu);
24
}
25
26
QAction *
MenuTaskMenu
::
preferredEditAction
()
const
27
{
28
return
nullptr
;
29
}
30
31
QList
<
QAction
*>
MenuTaskMenu
::
taskActions
()
const
32
{
33
QList<QAction*> rc;
34
rc.push_back(m_removeAction);
35
m_promotionTaskMenu->addActions(PromotionTaskMenu::LeadingSeparator, rc);
36
return
rc;
37
}
38
39
void
MenuTaskMenu
::removeMenu()
40
{
41
// Are we on a menu bar or on a menu?
42
QWidget
*pw = m_menu->parentWidget();
43
if
(QDesignerMenuBar *mb = qobject_cast<QDesignerMenuBar *>(pw)) {
44
mb->deleteMenuAction(m_menu->menuAction());
45
return
;
46
}
47
if
(QDesignerMenu *m = qobject_cast<QDesignerMenu *>(pw)) {
48
m->deleteAction(m_menu->menuAction());
49
}
50
}
51
52
// ------------- MenuBarTaskMenu
53
MenuBarTaskMenu
::MenuBarTaskMenu(QDesignerMenuBar *bar, QObject *parent) :
54
QObject(parent),
55
m_bar(bar)
56
{
57
}
58
59
QAction *
MenuBarTaskMenu
::
preferredEditAction
()
const
60
{
61
return
nullptr
;
62
}
63
64
QList
<
QAction
*>
MenuBarTaskMenu
::
taskActions
()
const
65
{
66
return
m_bar->contextMenuActions();
67
}
68
}
69
70
QT_END_NAMESPACE
QPainter::QWidget
friend class QWidget
Definition
qpainter.h:432
qdesigner_internal::MenuBarTaskMenu
Definition
menutaskmenu.h:49
qdesigner_internal::MenuBarTaskMenu::taskActions
QList< QAction * > taskActions() const override
Definition
menutaskmenu.cpp:64
qdesigner_internal::MenuBarTaskMenu::preferredEditAction
QAction * preferredEditAction() const override
Definition
menutaskmenu.cpp:59
qdesigner_internal::MenuTaskMenu
Definition
menutaskmenu.h:27
qdesigner_internal::MenuTaskMenu::preferredEditAction
QAction * preferredEditAction() const override
Definition
menutaskmenu.cpp:26
qdesigner_internal::MenuTaskMenu::taskActions
QList< QAction * > taskActions() const override
Definition
menutaskmenu.cpp:31
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qdesigner_internal
Auxiliary methods to store/retrieve settings.
Definition
buddyeditor.cpp:67
qttools
src
designer
src
components
taskmenu
menutaskmenu.cpp
Generated on
for Qt by
1.16.1