7#include <QtDesigner/qdesignerformeditorinterface.h>
8#include <QtDesigner/qdesignerformwindowmanagerinterface.h>
10#include <QtGui/qaction.h>
12#include <QtCore/qdebug.h>
13#include <QtCore/qtplugin.h>
15QView3DPlugin::QView3DPlugin()
30 m_action =
new QAction(tr(
"3D View"),
this);
34 connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)),
35 this, SLOT(addFormWindow(QDesignerFormWindowInterface*)));
37 connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
38 this, SLOT(removeFormWindow(QDesignerFormWindowInterface*)));
40 connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
41 this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*)));
54void QView3DPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
56 m_action->setEnabled(formWindow != 0);
59void QView3DPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow)
61 Q_ASSERT(formWindow != 0);
62 Q_ASSERT(m_tool_list.contains(formWindow) ==
false);
64 QView3DTool *tool =
new QView3DTool(formWindow,
this);
65 m_tool_list[formWindow] = tool;
66 connect(m_action, SIGNAL(triggered()), tool
->action(), SLOT(trigger()));
67 formWindow->registerTool(tool);
70void QView3DPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindow)
72 Q_ASSERT(formWindow != 0);
73 Q_ASSERT(m_tool_list.contains(formWindow));
76 m_tool_list.remove(formWindow);
77 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.