Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
tabordereditor_plugin.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
<
QtGui
/
qaction
.
h
>
6
7
#
include
"tabordereditor_plugin.h"
8
#
include
"tabordereditor_tool.h"
9
10
#
include
<
iconloader_p
.
h
>
11
12
#
include
<
QtDesigner
/
abstractformeditor
.
h
>
13
#
include
<
QtDesigner
/
abstractformwindow
.
h
>
14
#
include
<
QtDesigner
/
abstractformwindowmanager
.
h
>
15
16
QT_BEGIN_NAMESPACE
17
18
using
namespace
Qt::StringLiterals;
19
20
namespace
qdesigner_internal
{
21
22
TabOrderEditorPlugin
::TabOrderEditorPlugin() =
default
;
23
24
TabOrderEditorPlugin
::~
TabOrderEditorPlugin
() =
default
;
25
26
bool
TabOrderEditorPlugin
::
isInitialized
()
const
27
{
28
return
m_initialized;
29
}
30
31
void
TabOrderEditorPlugin
::
initialize
(QDesignerFormEditorInterface *core)
32
{
33
Q_ASSERT(!
isInitialized
(
)
);
34
35
m_action =
new
QAction(tr(
"Edit Tab Order"
),
this
);
36
m_action->setObjectName(u"_qt_edit_tab_order_action"_s);
37
m_action->setIcon(createIconSet(
"tabordertool.png"_L1
));
38
m_action->setEnabled(
false
);
39
40
setParent(core);
41
m_core = core;
42
m_initialized =
true
;
43
44
connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded,
45
this
, &TabOrderEditorPlugin::addFormWindow);
46
47
connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved,
48
this
, &
TabOrderEditorPlugin
::removeFormWindow);
49
50
connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
51
this
, &TabOrderEditorPlugin::activeFormWindowChanged);
52
}
53
54
void
TabOrderEditorPlugin
::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
55
{
56
m_action->setEnabled(formWindow !=
nullptr
);
57
}
58
59
QDesignerFormEditorInterface *
TabOrderEditorPlugin
::
core
()
const
60
{
61
return
m_core;
62
}
63
64
void
TabOrderEditorPlugin
::addFormWindow(QDesignerFormWindowInterface *formWindow)
65
{
66
Q_ASSERT(formWindow !=
nullptr
);
67
Q_ASSERT(m_tools.contains(formWindow) ==
false
);
68
69
TabOrderEditorTool
*tool =
new
TabOrderEditorTool(formWindow,
this
);
70
m_tools[formWindow] = tool;
71
connect(m_action, &QAction::triggered, tool
->
action
(
)
, &QAction::trigger);
72
formWindow->registerTool(tool);
73
}
74
75
void
TabOrderEditorPlugin
::removeFormWindow(QDesignerFormWindowInterface *formWindow)
76
{
77
Q_ASSERT(formWindow !=
nullptr
);
78
Q_ASSERT(m_tools.contains(formWindow) ==
true
);
79
80
TabOrderEditorTool
*tool = m_tools.value(formWindow);
81
m_tools.remove(formWindow);
82
disconnect(m_action, &QAction::triggered, tool
->
action
(
)
, &QAction::trigger);
83
// ### FIXME disable the tool
84
85
delete
tool;
86
}
87
88
QAction *
TabOrderEditorPlugin
::
action
()
const
89
{
90
return
m_action;
91
}
92
93
}
// namespace qdesigner_internal
94
95
QT_END_NAMESPACE
96
97
#
include
"moc_tabordereditor_plugin.cpp"
qdesigner_internal::TabOrderEditorPlugin
Definition
tabordereditor_plugin.h:25
qdesigner_internal::TabOrderEditorPlugin::~TabOrderEditorPlugin
~TabOrderEditorPlugin() override
qdesigner_internal::TabOrderEditorPlugin::core
QDesignerFormEditorInterface * core() const override
Returns the core form editor interface associated with this component.
Definition
tabordereditor_plugin.cpp:59
qdesigner_internal::TabOrderEditorPlugin::initialize
void initialize(QDesignerFormEditorInterface *core) override
Initializes the plugin interface for the specified core interface.
Definition
tabordereditor_plugin.cpp:31
qdesigner_internal::TabOrderEditorPlugin::isInitialized
bool isInitialized() const override
Returns true if the plugin interface is initialized; otherwise returns false.
Definition
tabordereditor_plugin.cpp:26
qdesigner_internal::TabOrderEditorPlugin::action
QAction * action() const override
Returns the action associated with this interface.
Definition
tabordereditor_plugin.cpp:88
qdesigner_internal::TabOrderEditorTool
Definition
tabordereditor_tool.h:25
qdesigner_internal::TabOrderEditorTool::action
QAction * action() const override
Definition
tabordereditor_tool.cpp:69
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
tabordereditor
tabordereditor_plugin.cpp
Generated on
for Qt by
1.18.0