Commit 81430315 authored by Marco Bubke's avatar Marco Bubke

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();
}
......
......@@ -30,7 +30,9 @@
#ifndef STATESEDITORVIEW_H
#define STATESEDITORVIEW_H
#include <qmlmodelview.h>
#include <abstractview.h>
#include <qmlstate.h>
namespace QmlDesigner {
......@@ -38,7 +40,7 @@ namespace QmlDesigner {
class StatesEditorModel;
class StatesEditorWidget;
class StatesEditorView : public QmlModelView {
class StatesEditorView : public AbstractView {
Q_OBJECT
public:
......@@ -74,7 +76,7 @@ public:
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;
// QmlModelView
// AbstractView
void actualStateChanged(const ModelNode &node) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
......
......@@ -60,7 +60,6 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/plaintexteditmodifier.cpp \
$$PWD/model/componenttextmodifier.cpp \
$$PWD/model/textmodifier.cpp \
$$PWD/model/qmlmodelview.cpp \
$$PWD/model/qmlitemnode.cpp \
$$PWD/model/qmlstate.cpp \
$$PWD/model/qmlchangeset.cpp \
......@@ -129,7 +128,6 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/textmodifier.h \
$$PWD/model/modeltotextmerger.h \
$$PWD/model/texttomodelmerger.h \
$$PWD/include/qmlmodelview.h \
$$PWD/include/qmlitemnode.h \
$$PWD/include/qmlstate.h \
$$PWD/include/qmlchangeset.h \
......
......@@ -55,7 +55,6 @@ namespace QmlDesigner {
namespace QmlDesigner {
class QmlModelView;
class NodeInstanceView;
class RewriterView;
......@@ -228,7 +227,6 @@ public:
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) = 0;
QmlModelView *toQmlModelView();
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
......
......@@ -35,7 +35,8 @@
namespace QmlDesigner {
class QmlModelView;
class AbstractView;
class NodeInstanceView;
class QMLDESIGNERCORE_EXPORT QmlModelNodeFacade
{
......@@ -48,9 +49,10 @@ public:
virtual ~QmlModelNodeFacade();
QmlModelNodeFacade();
bool isRootNode() const;
static QmlModelView* qmlModelView();
AbstractView *view() const;
static NodeInstanceView *nodeInstanceView();
bool isRootNode() const;
protected:
QmlModelNodeFacade(const ModelNode &modelNode);
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QMLMODELVIEW_H
#define QMLMODELVIEW_H
#include <qmldesignercorelib_global.h>
#include <abstractview.h>
#include "qmlitemnode.h"
#include "qmlstate.h"
#include "nodeinstanceview.h"
namespace QmlDesigner {
class ItemLibraryEntry;
class QMLDESIGNERCORE_EXPORT QmlModelView : public AbstractView
{
Q_OBJECT
friend class QmlObjectNode;
friend class QmlModelNodeFacade;
public:
QmlModelView(QObject *parent) ;
};
} //QmlDesigner
#endif // QMLMODELVIEW_H
......@@ -36,9 +36,9 @@
namespace QmlDesigner {
class QmlModelView;
class QmlModelStateGroup;
class AbstractViewAbstractVieweGroup;
class QmlObjectNode;
class QmlModelStateGroup;
class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade
{
......@@ -76,7 +76,7 @@ public:
protected:
void addChangeSetIfNotExists(const ModelNode &node);
static QmlModelState createBaseState(const QmlModelView *view);
static QmlModelState createBaseState(const AbstractView *view);
};
......
......@@ -83,8 +83,7 @@ public:
void pushInFileComponentOnCrambleBar(const QString &componentId);
void nextFileIsCalledInternally();
//used by DesignDocument ### find a better solution
QmlModelView *qmlModelView();
NodeInstanceView *nodeInstanceView();
private: // functions
Q_DISABLE_COPY(ViewManager)
......
......@@ -32,7 +32,7 @@
#include "model.h"
#include "model_p.h"
#include "internalnode_p.h"
#include <qmlmodelview.h>
#include "nodeinstanceview.h"
namespace QmlDesigner {
......@@ -399,11 +399,6 @@ bool AbstractView::hasModelNodeForInternalId(qint32 internalId) const
return model()->d->hasNodeForInternalId(internalId);
}
QmlModelView *AbstractView::toQmlModelView()
{
return qobject_cast<QmlModelView*>(this);
}
NodeInstanceView *AbstractView::nodeInstanceView() const
{
if (model())
......
......@@ -84,17 +84,15 @@ const QList<ModelNode> NodeListProperty::toModelNodeList() const
const QList<QmlObjectNode> NodeListProperty::toQmlObjectNodeList() const