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