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
toolbar_taskmenu.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
7
8#include <QtDesigner/abstractformwindow.h>
9
10#include <promotiontaskmenu_p.h>
11#include <qdesigner_command_p.h>
12
13#include <QtGui/qaction.h>
14#include <QtGui/qundostack.h>
15
16#include <QtCore/qdebug.h>
17
19
20namespace qdesigner_internal {
21 // ------------ ToolBarTaskMenu
22 ToolBarTaskMenu::ToolBarTaskMenu(QToolBar *tb, QObject *parent) :
23 QObject(parent),
24 m_toolBar(tb)
25 {
26 }
27
29 {
30 return nullptr;
31 }
32
34 {
35 if (ToolBarEventFilter *ef = ToolBarEventFilter::eventFilterOf(m_toolBar))
36 return ef->contextMenuActions();
37 return {};
38 }
39
40 // ------------ StatusBarTaskMenu
41 StatusBarTaskMenu::StatusBarTaskMenu(QStatusBar *sb, QObject *parent) :
42 QObject(parent),
43 m_statusBar(sb),
44 m_removeAction(new QAction(tr("Remove"), this)),
45 m_promotionTaskMenu(new PromotionTaskMenu(sb, PromotionTaskMenu::ModeSingleWidget, this))
46 {
47 connect(m_removeAction, &QAction::triggered, this, &StatusBarTaskMenu::removeStatusBar);
48 }
49
51 {
52 return nullptr;
53 }
54
56 {
57 QList<QAction*> rc;
58 rc.push_back(m_removeAction);
59 m_promotionTaskMenu->addActions(PromotionTaskMenu::LeadingSeparator, rc);
60 return rc;
61 }
62
63 void StatusBarTaskMenu::removeStatusBar()
64 {
65 if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(m_statusBar)) {
66 DeleteStatusBarCommand *cmd = new DeleteStatusBarCommand(fw);
67 cmd->init(m_statusBar);
68 fw->commandHistory()->push(cmd);
69 }
70 }
71}
72
73QT_END_NAMESPACE
QList< QAction * > taskActions() const override
QAction * preferredEditAction() const override
QAction * preferredEditAction() const override
QList< QAction * > taskActions() const override
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.