Skip to content
Snippets Groups Projects
Commit ba69c69a authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann
Browse files

QmlDesigner: Add interface to add custom form editor tools


Change-Id: Iae3d4b5db84c4a5f59ff8b4b1208b02b895df00f
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 7c9b1d6d
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,7 @@ FormEditorView::~FormEditorView() ...@@ -90,6 +90,7 @@ FormEditorView::~FormEditorView()
delete m_dragTool; delete m_dragTool;
m_dragTool = 0; m_dragTool = 0;
qDeleteAll(m_toolList);
// delete scene after tools to prevent double deletion // delete scene after tools to prevent double deletion
// of items // of items
...@@ -406,6 +407,11 @@ void FormEditorView::changeToTransformTools() ...@@ -406,6 +407,11 @@ void FormEditorView::changeToTransformTools()
changeToSelectionTool(); changeToSelectionTool();
} }
void FormEditorView::registerTool(AbstractFormEditorTool *tool)
{
m_toolList.append(tool);
}
void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int /*newIndex*/, int /*oldIndex*/) void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int /*newIndex*/, int /*oldIndex*/)
{ {
QList<ModelNode> newOrderModelNodeList = listProperty.toModelNodeList(); QList<ModelNode> newOrderModelNodeList = listProperty.toModelNodeList();
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
void changeToResizeTool(); void changeToResizeTool();
void changeToTransformTools(); void changeToTransformTools();
void registerTool(AbstractFormEditorTool *tool);
void nodeSlidedToIndex(const NodeListProperty &listProperty, int newIndex, int oldIndex); void nodeSlidedToIndex(const NodeListProperty &listProperty, int newIndex, int oldIndex);
void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data); void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data);
...@@ -136,6 +138,7 @@ private: //functions ...@@ -136,6 +138,7 @@ private: //functions
private: //variables private: //variables
QWeakPointer<FormEditorWidget> m_formEditorWidget; QWeakPointer<FormEditorWidget> m_formEditorWidget;
QWeakPointer<FormEditorScene> m_scene; QWeakPointer<FormEditorScene> m_scene;
QList<AbstractFormEditorTool*> m_toolList;
MoveTool *m_moveTool; MoveTool *m_moveTool;
SelectionTool *m_selectionTool; SelectionTool *m_selectionTool;
ResizeTool *m_resizeTool; ResizeTool *m_resizeTool;
......
...@@ -69,6 +69,7 @@ public: ...@@ -69,6 +69,7 @@ public:
void setNodeInstanceViewQtPath(const QString & qtPath); void setNodeInstanceViewQtPath(const QString & qtPath);
void resetPropertyEditorView(); void resetPropertyEditorView();
void resisterFormEditorTool(AbstractFormEditorTool *tool); // takes ownership
QWidget *formEditorWidget(); QWidget *formEditorWidget();
QWidget *propertyEditorWidget(); QWidget *propertyEditorWidget();
......
...@@ -82,6 +82,11 @@ void ViewManager::resetPropertyEditorView() ...@@ -82,6 +82,11 @@ void ViewManager::resetPropertyEditorView()
m_propertyEditorView.resetView(); m_propertyEditorView.resetView();
} }
void ViewManager::resisterFormEditorTool(AbstractFormEditorTool *tool)
{
m_formEditorView.registerTool(tool);
}
void ViewManager::detachViewsExceptRewriterAndComponetView() void ViewManager::detachViewsExceptRewriterAndComponetView()
{ {
switchStateEditorViewToBaseState(); switchStateEditorViewToBaseState();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment