8#include <QtDesigner/qdesignerformeditorinterface.h>
9#include <QtDesigner/qdesignerformwindowmanagerinterface.h>
11#include <QtGui/qaction.h>
13#include <QtCore/qdebug.h>
14#include <QtCore/qtplugin.h>
16QView3DPlugin::QView3DPlugin()
31 m_action =
new QAction(tr(
"3D View"),
this);
35 connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)),
36 this, SLOT(addFormWindow(QDesignerFormWindowInterface*)));
38 connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
39 this, SLOT(removeFormWindow(QDesignerFormWindowInterface*)));
41 connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
42 this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*)));
55void QView3DPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
57 m_action->setEnabled(formWindow != 0);
60void QView3DPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow)
62 Q_ASSERT(formWindow != 0);
63 Q_ASSERT(m_tool_list.contains(formWindow) ==
false);
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);
71void QView3DPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindow)
73 Q_ASSERT(formWindow != 0);
74 Q_ASSERT(m_tool_list.contains(formWindow));
77 m_tool_list.remove(formWindow);
78 disconnect(m_action, SIGNAL(triggered()), tool
->action(), SLOT(trigger()));
void initialize(QDesignerFormEditorInterface *core) override
Initializes the plugin interface for the specified core interface.
QAction * action() const override
Returns the action associated with this interface.
QDesignerFormEditorInterface * core() const override
Returns the core form editor interface associated with this component.
bool isInitialized() const override
Returns true if the plugin interface is initialized; otherwise returns false.