Commit 81430315 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Remove QmlModelView



And use NodeInstanceView directly. There is still more cleanup required
for the view handling.

Change-Id: I62417644ceefb25fb9f3bb93a894b71ae0929cb0
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent a6c43c63
......@@ -32,7 +32,7 @@
#include <qmldesignercorelib_global.h>
#include "abstractdesigneraction.h"
#include "qmlmodelview.h"
#include "abstractview.h"
namespace QmlDesigner {
......
......@@ -37,7 +37,7 @@
namespace QmlDesigner {
ModelNodeContextMenu::ModelNodeContextMenu(QmlModelView *view) :
ModelNodeContextMenu::ModelNodeContextMenu(AbstractView *view) :
m_selectionContext(view)
{
}
......@@ -111,7 +111,7 @@ void ModelNodeContextMenu::setScenePos(const QPoint &position)
m_scenePos = position;
}
void ModelNodeContextMenu::showContextMenu(QmlModelView *view,
void ModelNodeContextMenu::showContextMenu(AbstractView *view,
const QPoint &globalPosition,
const QPoint &scenePosition,
bool showSelection)
......
......@@ -33,7 +33,7 @@
#include <QPoint>
#include <QCoreApplication>
#include <qmlmodelview.h>
#include <abstractview.h>
#include "selectioncontext.h"
namespace QmlDesigner {
......@@ -42,11 +42,11 @@ class ModelNodeContextMenu
{
Q_DECLARE_TR_FUNCTIONS(QmlDesigner::ModelNodeContextMenu)
public:
ModelNodeContextMenu(QmlModelView *view);
ModelNodeContextMenu(AbstractView *view);
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);
static void showContextMenu(AbstractView *view, const QPoint &globalPosition, const QPoint &scenePosition, bool showSelection);
private:
QPoint m_scenePos;
......
......@@ -32,6 +32,7 @@
#include "modelnodeoperations.h"
#include "defaultdesigneraction.h"
#include "qmlitemnode.h"
#include <QAction>
#include <QMenu>
......
......@@ -29,6 +29,8 @@
#include "selectioncontext.h"
#include <qmlstate.h>
namespace QmlDesigner {
......
......@@ -28,7 +28,8 @@
****************************************************************************/
#include <qmldesignercorelib_global.h>
#include <qmlmodelview.h>
#include <abstractview.h>
#include <QPoint>
#ifndef SELECTIONCONTEXT_H
#define SELECTIONCONTEXT_H
......
......@@ -56,7 +56,7 @@ namespace QmlDesigner {
namespace Internal {
DebugView::DebugView(QObject *parent) : QmlModelView(parent),
DebugView::DebugView(QObject *parent) : AbstractView(parent),
m_debugViewWidget(new DebugViewWidget)
{
}
......@@ -70,13 +70,13 @@ void DebugView::modelAttached(Model *model)
log(tr("Model attached"), tr("FileName %1").arg(model->fileUrl().toLocalFile()));
m_debugViewWidget->setDebugViewEnabled(isDebugViewEnabled());
qDebug() << "enabled: " << isDebugViewEnabled();
QmlModelView::modelAttached(model);
AbstractView::modelAttached(model);
}
void DebugView::modelAboutToBeDetached(Model *model)
{
log(tr("Model detached"), tr("FileName %1").arg(model->fileUrl().toLocalFile()));
QmlModelView::modelAboutToBeDetached(model);
AbstractView::modelAboutToBeDetached(model);
}
void DebugView::importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports)
......
......@@ -30,7 +30,7 @@
#ifndef DEBUGVIEW_H
#define DEBUGVIEW_H
#include <qmlmodelview.h>
#include <abstractview.h>
#include <QPointer>
namespace QmlDesigner {
......@@ -39,7 +39,7 @@ namespace Internal {
class DebugViewWidget;
class DebugView : public QmlModelView
class DebugView : public AbstractView
{
Q_OBJECT
......
......@@ -53,7 +53,7 @@
namespace QmlDesigner {
FormEditorView::FormEditorView(QObject *parent)
: QmlModelView(parent),
: AbstractView(parent),
m_formEditorWidget(new FormEditorWidget(this)),
m_scene(new FormEditorScene(m_formEditorWidget.data(), this)),
m_moveTool(new MoveTool(this)),
......@@ -100,7 +100,7 @@ void FormEditorView::modelAttached(Model *model)
{
Q_ASSERT(model);
QmlModelView::modelAttached(model);
AbstractView::modelAttached(model);
Q_ASSERT(m_scene->formLayerItem());
......@@ -177,7 +177,7 @@ void FormEditorView::modelAboutToBeDetached(Model *model)
m_currentTool = m_selectionTool;
QmlModelView::modelAboutToBeDetached(model);
AbstractView::modelAboutToBeDetached(model);
}
void FormEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
......@@ -456,7 +456,7 @@ void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int
void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data)
{
QmlModelView::auxiliaryDataChanged(node, name, data);
AbstractView::auxiliaryDataChanged(node, name, data);
if (name == "invisible" && m_scene->hasItemForQmlItemNode(QmlItemNode(node))) {
FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node)));
bool isInvisible = data.toBool();
......
......@@ -30,7 +30,7 @@
#ifndef FORMEDITORVIEW_H
#define FORMEDITORVIEW_H
#include <qmlmodelview.h>
#include <abstractview.h>
QT_BEGIN_NAMESPACE
class QGraphicsScene;
......@@ -57,7 +57,7 @@ class DragTool;
class ItemLibraryEntry;
class QmlItemNode;
class QMLDESIGNERCORE_EXPORT FormEditorView : public QmlModelView
class QMLDESIGNERCORE_EXPORT FormEditorView : public AbstractView
{
Q_OBJECT
......
......@@ -32,6 +32,8 @@
#include "formeditorview.h"
#include <QPointF>
namespace QmlDesigner {
class SingleSelectionManipulator
......
......@@ -165,9 +165,9 @@ bool DesignDocument::loadInFileComponent(const ModelNode &componentNode)
return true;
}
QmlModelView *DesignDocument::qmlModelView()
AbstractView *DesignDocument::view()
{
return viewManager().qmlModelView();
return viewManager().nodeInstanceView();
}
Model* DesignDocument::createInFileComponentModel()
......@@ -319,7 +319,7 @@ void DesignDocument::goIntoSelectedComponent()
QList<ModelNode> selectedNodes;
if (rewriterView())
selectedNodes = qmlModelView()->selectedModelNodes();
selectedNodes = view()->selectedModelNodes();
if (selectedNodes.count() == 1) {
viewManager().setComponentNode(selectedNodes.first());
......@@ -377,7 +377,7 @@ void DesignDocument::deleteSelected()
try {
RewriterTransaction transaction(rewriterView());
QList<ModelNode> toDelete = qmlModelView()->selectedModelNodes();
QList<ModelNode> toDelete = view()->selectedModelNodes();
foreach (ModelNode node, toDelete) {
if (node.isValid() && !node.isRootNode() && QmlObjectNode::isValidQmlObjectNode(node))
QmlObjectNode(node).destroy();
......
......@@ -57,7 +57,7 @@ class TextModifier;
class QmlObjectNode;
class CrumbleBarInfo;
class ViewManager;
class QmlModelView;
class AbstractView;
class QMLDESIGNERCORE_EXPORT DesignDocument: public QObject
{
......@@ -140,7 +140,7 @@ private: // functions
bool loadInFileComponent(const ModelNode &componentNode);
QmlModelView *qmlModelView();
AbstractView *view();
Model *createInFileComponentModel();
......
......@@ -34,11 +34,12 @@
#include <nodeproperty.h>
#include <variantproperty.h>
#include <metainfo.h>
#include <qmlmodelview.h>
#include <abstractview.h>
#include <rewriterview.h>
#include <invalididexception.h>
#include <rewritingexception.h>
#include <modelnodecontextmenu.h>
#include <qmlitemnode.h>
#include <QMimeData>
#include <QMessageBox>
......@@ -380,7 +381,7 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::itemRowForNode(const ModelNode &
return m_nodeItemHash.value(node);
}
void NavigatorTreeModel::setView(QmlModelView *view)
void NavigatorTreeModel::setView(AbstractView *view)
{
m_view = view;
m_hiddenProperties.clear();
......
......@@ -39,7 +39,7 @@
namespace QmlDesigner {
class Model;
class QmlModelView;
class AbstractView;
class ModelNode;
class NavigatorTreeModel : public QStandardItemModel
......@@ -95,7 +95,7 @@ public:
int column,
const QModelIndex &parent);
void setView(QmlModelView *view);
void setView(AbstractView *view);
void clearView();
QModelIndex indexForNode(const ModelNode &node) const;
......@@ -140,7 +140,7 @@ private:
private:
QHash<ModelNode, ItemRow> m_nodeItemHash;
QHash<uint, ModelNode> m_nodeHash;
QWeakPointer<QmlModelView> m_view;
QWeakPointer<AbstractView> m_view;
bool m_blockItemChangedSignal;
......
......@@ -39,6 +39,7 @@
#include <nodelistproperty.h>
#include <variantproperty.h>
#include <QHeaderView>
#include <qmlitemnode.h>
static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPointF &pos)
{
......@@ -53,7 +54,7 @@ static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPo
namespace QmlDesigner {
NavigatorView::NavigatorView(QObject* parent) :
QmlModelView(parent),
AbstractView(parent),
m_blockSelectionChangedSignal(false),
m_widget(new NavigatorWidget(this)),
m_treeModel(new NavigatorTreeModel(this))
......@@ -114,7 +115,7 @@ WidgetInfo NavigatorView::widgetInfo()
void NavigatorView::modelAttached(Model *model)
{
QmlModelView::modelAttached(model);
AbstractView::modelAttached(model);
m_treeModel->setView(this);
......@@ -133,7 +134,7 @@ void NavigatorView::modelAttached(Model *model)
void NavigatorView::modelAboutToBeDetached(Model *model)
{
m_treeModel->clearView();
QmlModelView::modelAboutToBeDetached(model);
AbstractView::modelAboutToBeDetached(model);
}
void NavigatorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
......
......@@ -30,7 +30,7 @@
#ifndef NAVIGATORVIEW_H
#define NAVIGATORVIEW_H
#include <qmlmodelview.h>
#include <abstractview.h>
#include <QWeakPointer>
......@@ -48,7 +48,7 @@ class NavigatorTreeModel;
class IconCheckboxItemDelegate;
class IdItemDelegate;
class NavigatorView : public QmlModelView
class NavigatorView : public AbstractView
{
Q_OBJECT
......
......@@ -333,7 +333,7 @@ void PropertyEditor::NodeType::initialSetup(const TypeName &typeName, const QUrl
}
PropertyEditor::PropertyEditor(QWidget *parent) :
QmlModelView(parent),
AbstractView(parent),
m_parent(parent),
m_updateShortcut(0),
m_timerId(0),
......@@ -814,7 +814,7 @@ void PropertyEditor::nodeAboutToBeRemoved(const ModelNode &removedNode)
void PropertyEditor::modelAttached(Model *model)
{
QmlModelView::modelAttached(model);
AbstractView::modelAttached(model);
if (debug)
qDebug() << Q_FUNC_INFO;
......@@ -834,7 +834,7 @@ void PropertyEditor::modelAttached(Model *model)
void PropertyEditor::modelAboutToBeDetached(Model *model)
{
QmlModelView::modelAboutToBeDetached(model);
AbstractView::modelAboutToBeDetached(model);
m_currentType->m_propertyEditorTransaction->end();
resetView();
......
......@@ -30,7 +30,7 @@
#ifndef PROPERTYEDITOR_H
#define PROPERTYEDITOR_H
#include <qmlmodelview.h>
#include <abstractview.h>
#include <declarativewidgetview.h>
#include <QHash>
#include <QStackedWidget>
......@@ -55,7 +55,7 @@ class PropertyEditorTransaction;
class CollapseButton;
class StackedWidget;
class PropertyEditor: public QmlModelView
class PropertyEditor: public AbstractView
{
Q_OBJECT
......
......@@ -41,6 +41,8 @@
#include <variantproperty.h>
#include <nodelistproperty.h>
#include <qmlitemnode.h>
namespace QmlDesigner {
/**
......@@ -48,7 +50,7 @@ namespace QmlDesigner {
the current state is the base state, we render the base state + all other states.
*/
StatesEditorView::StatesEditorView(QObject *parent) :
QmlModelView(parent),
AbstractView(parent),
m_statesEditorModel(new StatesEditorModel(this)),
m_statesEditorWidget(new StatesEditorWidget(this, m_statesEditorModel.data())),
m_lastIndex(-1)
......@@ -304,11 +306,11 @@ void StatesEditorView::renameState(int nodeId, const QString &newName)
void StatesEditorView::modelAttached(Model *model)
{
if (model == QmlModelView::model())
if (model == AbstractView::model())
return;
Q_ASSERT(model);
QmlModelView::modelAttached(model);
AbstractView::modelAttached(model);
if (m_statesEditorWidget)
m_statesEditorWidget->setNodeInstanceView(nodeInstanceView());
......@@ -318,7 +320,7 @@ void StatesEditorView::modelAttached(Model *model)
void StatesEditorView::modelAboutToBeDetached(Model *model)
{
QmlModelView::modelAboutToBeDetached(model);
AbstractView::modelAboutToBeDetached(model);
resetModel();
}
......
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