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