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
view3d_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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"view3d_plugin.h"
6
#
include
"view3d_tool.h"
7
8
#
include
<
QtDesigner
/
qdesignerformeditorinterface
.
h
>
9
#
include
<
QtDesigner
/
qdesignerformwindowmanagerinterface
.
h
>
10
11
#
include
<
QtGui
/
qaction
.
h
>
12
13
#
include
<
QtCore
/
qdebug
.
h
>
14
#
include
<
QtCore
/
qtplugin
.
h
>
15
16
QView3DPlugin::QView3DPlugin()
17
{
18
m_core = 0;
19
m_action = 0;
20
}
21
22
bool
QView3DPlugin
::
isInitialized
()
const
23
{
24
return
m_core != 0;
25
}
26
27
void
QView3DPlugin
::
initialize
(QDesignerFormEditorInterface *core)
28
{
29
Q_ASSERT(!
isInitialized
(
)
);
30
31
m_action =
new
QAction(tr(
"3D View"
),
this
);
32
m_core = core;
33
setParent(core);
34
35
connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)),
36
this
, SLOT(addFormWindow(QDesignerFormWindowInterface*)));
37
38
connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
39
this
, SLOT(removeFormWindow(QDesignerFormWindowInterface*)));
40
41
connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
42
this
, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*)));
43
}
44
45
QAction *
QView3DPlugin
::
action
()
const
46
{
47
return
m_action;
48
}
49
50
QDesignerFormEditorInterface
*
QView3DPlugin
::
core
()
const
51
{
52
return
m_core;
53
}
54
55
void
QView3DPlugin
::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
56
{
57
m_action->setEnabled(formWindow != 0);
58
}
59
60
void
QView3DPlugin
::addFormWindow(QDesignerFormWindowInterface *formWindow)
61
{
62
Q_ASSERT(formWindow != 0);
63
Q_ASSERT(m_tool_list.contains(formWindow) ==
false
);
64
65
QView3DTool
*tool =
new
QView3DTool(formWindow,
this
);
66
m_tool_list[formWindow] = tool;
67
connect(m_action, SIGNAL(triggered()), tool
->
action
(
)
, SLOT(trigger()));
68
formWindow->registerTool(tool);
69
}
70
71
void
QView3DPlugin
::removeFormWindow(QDesignerFormWindowInterface *formWindow)
72
{
73
Q_ASSERT(formWindow != 0);
74
Q_ASSERT(m_tool_list.contains(formWindow));
75
76
QView3DTool
*tool = m_tool_list.value(formWindow);
77
m_tool_list.remove(formWindow);
78
disconnect(m_action, SIGNAL(triggered()), tool
->
action
(
)
, SLOT(trigger()));
79
80
delete
tool;
81
}
QView3DPlugin
Definition
view3d_plugin.h:22
QView3DPlugin::initialize
void initialize(QDesignerFormEditorInterface *core) override
Initializes the plugin interface for the specified core interface.
Definition
view3d_plugin.cpp:27
QView3DPlugin::action
QAction * action() const override
Returns the action associated with this interface.
Definition
view3d_plugin.cpp:45
QView3DPlugin::core
QDesignerFormEditorInterface * core() const override
Returns the core form editor interface associated with this component.
Definition
view3d_plugin.cpp:50
QView3DPlugin::isInitialized
bool isInitialized() const override
Returns true if the plugin interface is initialized; otherwise returns false.
Definition
view3d_plugin.cpp:22
QView3DTool
Definition
view3d_tool.h:17
QView3DTool::action
QAction * action() const override
Definition
view3d_tool.cpp:36
qttools
src
designer
src
plugins
tools
view3d
view3d_plugin.cpp
Generated on
for Qt by
1.18.0