Commit 43ff20d7 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Move modelnodecontextmenu to the navigator

The context node of the model node don't belongs to model because it has
dependencies.

Change-Id: Ia67a055a4beac33477485d05574134ffe4dc6ae1
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@nokia.com>
parent aa118de9
VPATH += $$PWD
INCLUDEPATH += $$PWD
SOURCES += modelnodecontextmenu.cpp
HEADERS += modelnodecontextmenu.h
......@@ -434,6 +434,12 @@ void ModelNodeContextMenu::setScenePos(const QPoint &pos)
m_scenePos = pos;
}
void ModelNodeContextMenu::showContextMenu(QmlModelView *view, const QPoint &globalPosition, const QPoint &scenePosition, bool showSelection)
{
ModelNodeContextMenu contextMenu(view);
contextMenu.setScenePos(scenePosition);
contextMenu.execute(globalPosition, showSelection);
}
ModelNodeAction* ModelNodeContextMenu::createModelNodeAction(const QString &description, QMenu *menu, const QList<ModelNode> &modelNodeList, ModelNodeAction::ModelNodeActionType type, bool enabled)
{
......
......@@ -118,6 +118,8 @@ public:
void execute(const QPoint &pos, bool selectionMenu);
void setScenePos(const QPoint &pos);
static void showContextMenu(QmlModelView *view, const QPoint &globalPosition, const QPoint &scenePosition, bool showSelection);
private:
ModelNodeAction* createModelNodeAction(const QString &description, QMenu *menu, const QList<ModelNode> &modelNodeList, ModelNodeAction::ModelNodeActionType type, bool enabled = true);
......
......@@ -32,6 +32,8 @@
#include "formeditorview.h"
#include "formeditorview.h"
#include <modelnodecontextmenu.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QDebug>
......@@ -211,7 +213,7 @@ void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &
void AbstractFormEditorTool::showContextMenu(QGraphicsSceneMouseEvent *event)
{
view()->showContextMenu(event->screenPos(), event->scenePos().toPoint(), true);
ModelNodeContextMenu::showContextMenu(view(), event->screenPos(), event->scenePos().toPoint(), true);
}
void AbstractFormEditorTool::clear()
......
......@@ -44,7 +44,7 @@
#include <nodelistproperty.h>
#include <variantproperty.h>
#include <rewritingexception.h>
#include <model/modelnodecontextmenu.h>
#include <modelnodecontextmenu.h>
#include <designmodewidget.h>
#include <projectexplorer/projectexplorer.h>
......
......@@ -4,6 +4,7 @@ SOURCES += navigatorview.cpp \
navigatortreemodel.cpp \
navigatorwidget.cpp \
navigatortreeview.cpp
HEADERS += navigatorview.h \
navigatortreemodel.h \
navigatorwidget.h \
......
......@@ -40,6 +40,7 @@
#include <rewriterview.h>
#include <invalididexception.h>
#include <rewritingexception.h>
#include <modelnodecontextmenu.h>
#include <QMimeData>
#include <QMessageBox>
......@@ -659,10 +660,9 @@ void NavigatorTreeModel::setVisible(const QModelIndex &index, bool visible)
itemRow.visibilityItem->setCheckState(visible ? Qt::Checked : Qt::Unchecked);
}
void NavigatorTreeModel::openContextMenu(const QPoint &p)
void NavigatorTreeModel::openContextMenu(const QPoint &position)
{
if (m_view)
m_view->showContextMenu(p, QPoint(), false);
ModelNodeContextMenu::showContextMenu(m_view.data(), position, QPoint(), false);
}
} // QmlDesigner
......@@ -31,6 +31,7 @@
#include "navigatorview.h"
#include "navigatortreemodel.h"
#include "navigatorwidget.h"
#include "modelnodecontextmenu.h"
#include <coreplugin/editormanager/editormanager.h>
......
......@@ -75,8 +75,7 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/rewriteactioncompressor.cpp \
$$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.cpp \
$$PWD/exceptions/rewritingexception.cpp \
$$PWD/model/modelnodecontextmenu.cpp
$$PWD/exceptions/rewritingexception.cpp
HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/abstractview.h \
......@@ -146,8 +145,7 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/modelmerger.h \
$$PWD/include/mathutils.h \
$$PWD/include/customnotifications.h \
$$PWD/include/rewritingexception.h \
$$PWD//model/modelnodecontextmenu.h
$$PWD/include/rewritingexception.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin
......
......@@ -121,8 +121,6 @@ public:
void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void showContextMenu(const QPoint &globalPos, const QPoint &scenePos, bool showSelection);
protected:
NodeInstance instanceForModelNode(const ModelNode &modelNode);
bool hasInstanceForModelNode(const ModelNode &modelNode);
......
......@@ -46,8 +46,6 @@
#include "rewriterview.h"
#include "plaintexteditmodifier.h"
#include "modelmerger.h"
#include "modelnodecontextmenu.h"
namespace QmlDesigner {
......@@ -425,13 +423,6 @@ void QmlModelView::nodeSourceChanged(const ModelNode &, const QString & /*newNod
}
void QmlModelView::showContextMenu(const QPoint &globalPos, const QPoint &scenePos, bool showSelection)
{
ModelNodeContextMenu contextMenu(this);
contextMenu.setScenePos(scenePos);
contextMenu.execute(globalPos, showSelection);
}
void QmlModelView::rewriterBeginTransaction()
{
......
HEADERS += $$PWD/qmldesignerconstants.h \
$$PWD/qmldesignerplugin.h \
$$PWD/designmodewidget.h \
$$PWD/designersettings.h \
$$PWD/settingspage.h \
$$PWD/designmodecontext.h \
$$PWD/styledoutputpaneplaceholder.h
SOURCES += $$PWD/qmldesignerplugin.cpp \
$$PWD/designmodewidget.cpp \
$$PWD/designersettings.cpp \
$$PWD/settingspage.cpp \
$$PWD/designmodecontext.cpp \
$$PWD/styledoutputpaneplaceholder.cpp
FORMS += $$PWD/settingspage.ui
......@@ -10,6 +10,7 @@ include(../../private_headers.pri)
include(qmldesigner_dependencies.pri)
include(designercore/designercore.pri)
include(components/componentcore/componentcore.pri)
include(components/integration/integration.pri)
include(components/propertyeditor/propertyeditor.pri)
include(components/formeditor/formeditor.pri)
......@@ -18,20 +19,4 @@ include(components/navigator/navigator.pri)
include(components/pluginmanager/pluginmanager.pri)
include(components/stateseditor/stateseditor.pri)
include(components/resources/resources.pri)
HEADERS += qmldesignerconstants.h \
qmldesignerplugin.h \
designmodewidget.h \
designersettings.h \
settingspage.h \
designmodecontext.h \
styledoutputpaneplaceholder.h
SOURCES += qmldesignerplugin.cpp \
designmodewidget.cpp \
designersettings.cpp \
settingspage.cpp \
designmodecontext.cpp \
styledoutputpaneplaceholder.cpp
FORMS += settingspage.ui
include(qmldesignerplugin.pri)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment