forked from qt-creator/qt-creator
QmlDesigner: Remove QmlModelView
And use NodeInstanceView directly. There is still more cleanup required for the view handling. Change-Id: I62417644ceefb25fb9f3bb93a894b71ae0929cb0 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <qmldesignercorelib_global.h>
|
#include <qmldesignercorelib_global.h>
|
||||||
#include "abstractdesigneraction.h"
|
#include "abstractdesigneraction.h"
|
||||||
#include "qmlmodelview.h"
|
#include "abstractview.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ModelNodeContextMenu::ModelNodeContextMenu(QmlModelView *view) :
|
ModelNodeContextMenu::ModelNodeContextMenu(AbstractView *view) :
|
||||||
m_selectionContext(view)
|
m_selectionContext(view)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ void ModelNodeContextMenu::setScenePos(const QPoint &position)
|
|||||||
m_scenePos = position;
|
m_scenePos = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelNodeContextMenu::showContextMenu(QmlModelView *view,
|
void ModelNodeContextMenu::showContextMenu(AbstractView *view,
|
||||||
const QPoint &globalPosition,
|
const QPoint &globalPosition,
|
||||||
const QPoint &scenePosition,
|
const QPoint &scenePosition,
|
||||||
bool showSelection)
|
bool showSelection)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
#include "selectioncontext.h"
|
#include "selectioncontext.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -42,11 +42,11 @@ class ModelNodeContextMenu
|
|||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(QmlDesigner::ModelNodeContextMenu)
|
Q_DECLARE_TR_FUNCTIONS(QmlDesigner::ModelNodeContextMenu)
|
||||||
public:
|
public:
|
||||||
ModelNodeContextMenu(QmlModelView *view);
|
ModelNodeContextMenu(AbstractView *view);
|
||||||
void execute(const QPoint &pos, bool selectionMenu);
|
void execute(const QPoint &pos, bool selectionMenu);
|
||||||
void setScenePos(const QPoint &pos);
|
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:
|
private:
|
||||||
QPoint m_scenePos;
|
QPoint m_scenePos;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "modelnodeoperations.h"
|
#include "modelnodeoperations.h"
|
||||||
#include "defaultdesigneraction.h"
|
#include "defaultdesigneraction.h"
|
||||||
|
#include "qmlitemnode.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "selectioncontext.h"
|
#include "selectioncontext.h"
|
||||||
|
|
||||||
|
#include <qmlstate.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
|
||||||
|
@@ -28,7 +28,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <qmldesignercorelib_global.h>
|
#include <qmldesignercorelib_global.h>
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
|
#include <QPoint>
|
||||||
|
|
||||||
#ifndef SELECTIONCONTEXT_H
|
#ifndef SELECTIONCONTEXT_H
|
||||||
#define SELECTIONCONTEXT_H
|
#define SELECTIONCONTEXT_H
|
||||||
|
@@ -56,7 +56,7 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
DebugView::DebugView(QObject *parent) : QmlModelView(parent),
|
DebugView::DebugView(QObject *parent) : AbstractView(parent),
|
||||||
m_debugViewWidget(new DebugViewWidget)
|
m_debugViewWidget(new DebugViewWidget)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -70,13 +70,13 @@ void DebugView::modelAttached(Model *model)
|
|||||||
log(tr("Model attached"), tr("FileName %1").arg(model->fileUrl().toLocalFile()));
|
log(tr("Model attached"), tr("FileName %1").arg(model->fileUrl().toLocalFile()));
|
||||||
m_debugViewWidget->setDebugViewEnabled(isDebugViewEnabled());
|
m_debugViewWidget->setDebugViewEnabled(isDebugViewEnabled());
|
||||||
qDebug() << "enabled: " << isDebugViewEnabled();
|
qDebug() << "enabled: " << isDebugViewEnabled();
|
||||||
QmlModelView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugView::modelAboutToBeDetached(Model *model)
|
void DebugView::modelAboutToBeDetached(Model *model)
|
||||||
{
|
{
|
||||||
log(tr("Model detached"), tr("FileName %1").arg(model->fileUrl().toLocalFile()));
|
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)
|
void DebugView::importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports)
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef DEBUGVIEW_H
|
#ifndef DEBUGVIEW_H
|
||||||
#define DEBUGVIEW_H
|
#define DEBUGVIEW_H
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -39,7 +39,7 @@ namespace Internal {
|
|||||||
|
|
||||||
class DebugViewWidget;
|
class DebugViewWidget;
|
||||||
|
|
||||||
class DebugView : public QmlModelView
|
class DebugView : public AbstractView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -53,7 +53,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
FormEditorView::FormEditorView(QObject *parent)
|
FormEditorView::FormEditorView(QObject *parent)
|
||||||
: QmlModelView(parent),
|
: AbstractView(parent),
|
||||||
m_formEditorWidget(new FormEditorWidget(this)),
|
m_formEditorWidget(new FormEditorWidget(this)),
|
||||||
m_scene(new FormEditorScene(m_formEditorWidget.data(), this)),
|
m_scene(new FormEditorScene(m_formEditorWidget.data(), this)),
|
||||||
m_moveTool(new MoveTool(this)),
|
m_moveTool(new MoveTool(this)),
|
||||||
@@ -100,7 +100,7 @@ void FormEditorView::modelAttached(Model *model)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(model);
|
Q_ASSERT(model);
|
||||||
|
|
||||||
QmlModelView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
|
|
||||||
Q_ASSERT(m_scene->formLayerItem());
|
Q_ASSERT(m_scene->formLayerItem());
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ void FormEditorView::modelAboutToBeDetached(Model *model)
|
|||||||
|
|
||||||
m_currentTool = m_selectionTool;
|
m_currentTool = m_selectionTool;
|
||||||
|
|
||||||
QmlModelView::modelAboutToBeDetached(model);
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
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)
|
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))) {
|
if (name == "invisible" && m_scene->hasItemForQmlItemNode(QmlItemNode(node))) {
|
||||||
FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node)));
|
FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node)));
|
||||||
bool isInvisible = data.toBool();
|
bool isInvisible = data.toBool();
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef FORMEDITORVIEW_H
|
#ifndef FORMEDITORVIEW_H
|
||||||
#define FORMEDITORVIEW_H
|
#define FORMEDITORVIEW_H
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
@@ -57,7 +57,7 @@ class DragTool;
|
|||||||
class ItemLibraryEntry;
|
class ItemLibraryEntry;
|
||||||
class QmlItemNode;
|
class QmlItemNode;
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT FormEditorView : public QmlModelView
|
class QMLDESIGNERCORE_EXPORT FormEditorView : public AbstractView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include "formeditorview.h"
|
#include "formeditorview.h"
|
||||||
|
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class SingleSelectionManipulator
|
class SingleSelectionManipulator
|
||||||
|
@@ -165,9 +165,9 @@ bool DesignDocument::loadInFileComponent(const ModelNode &componentNode)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlModelView *DesignDocument::qmlModelView()
|
AbstractView *DesignDocument::view()
|
||||||
{
|
{
|
||||||
return viewManager().qmlModelView();
|
return viewManager().nodeInstanceView();
|
||||||
}
|
}
|
||||||
|
|
||||||
Model* DesignDocument::createInFileComponentModel()
|
Model* DesignDocument::createInFileComponentModel()
|
||||||
@@ -319,7 +319,7 @@ void DesignDocument::goIntoSelectedComponent()
|
|||||||
|
|
||||||
QList<ModelNode> selectedNodes;
|
QList<ModelNode> selectedNodes;
|
||||||
if (rewriterView())
|
if (rewriterView())
|
||||||
selectedNodes = qmlModelView()->selectedModelNodes();
|
selectedNodes = view()->selectedModelNodes();
|
||||||
|
|
||||||
if (selectedNodes.count() == 1) {
|
if (selectedNodes.count() == 1) {
|
||||||
viewManager().setComponentNode(selectedNodes.first());
|
viewManager().setComponentNode(selectedNodes.first());
|
||||||
@@ -377,7 +377,7 @@ void DesignDocument::deleteSelected()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
RewriterTransaction transaction(rewriterView());
|
RewriterTransaction transaction(rewriterView());
|
||||||
QList<ModelNode> toDelete = qmlModelView()->selectedModelNodes();
|
QList<ModelNode> toDelete = view()->selectedModelNodes();
|
||||||
foreach (ModelNode node, toDelete) {
|
foreach (ModelNode node, toDelete) {
|
||||||
if (node.isValid() && !node.isRootNode() && QmlObjectNode::isValidQmlObjectNode(node))
|
if (node.isValid() && !node.isRootNode() && QmlObjectNode::isValidQmlObjectNode(node))
|
||||||
QmlObjectNode(node).destroy();
|
QmlObjectNode(node).destroy();
|
||||||
|
@@ -57,7 +57,7 @@ class TextModifier;
|
|||||||
class QmlObjectNode;
|
class QmlObjectNode;
|
||||||
class CrumbleBarInfo;
|
class CrumbleBarInfo;
|
||||||
class ViewManager;
|
class ViewManager;
|
||||||
class QmlModelView;
|
class AbstractView;
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT DesignDocument: public QObject
|
class QMLDESIGNERCORE_EXPORT DesignDocument: public QObject
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ private: // functions
|
|||||||
|
|
||||||
bool loadInFileComponent(const ModelNode &componentNode);
|
bool loadInFileComponent(const ModelNode &componentNode);
|
||||||
|
|
||||||
QmlModelView *qmlModelView();
|
AbstractView *view();
|
||||||
|
|
||||||
Model *createInFileComponentModel();
|
Model *createInFileComponentModel();
|
||||||
|
|
||||||
|
@@ -34,11 +34,12 @@
|
|||||||
#include <nodeproperty.h>
|
#include <nodeproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <metainfo.h>
|
#include <metainfo.h>
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
#include <rewriterview.h>
|
#include <rewriterview.h>
|
||||||
#include <invalididexception.h>
|
#include <invalididexception.h>
|
||||||
#include <rewritingexception.h>
|
#include <rewritingexception.h>
|
||||||
#include <modelnodecontextmenu.h>
|
#include <modelnodecontextmenu.h>
|
||||||
|
#include <qmlitemnode.h>
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -380,7 +381,7 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::itemRowForNode(const ModelNode &
|
|||||||
return m_nodeItemHash.value(node);
|
return m_nodeItemHash.value(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigatorTreeModel::setView(QmlModelView *view)
|
void NavigatorTreeModel::setView(AbstractView *view)
|
||||||
{
|
{
|
||||||
m_view = view;
|
m_view = view;
|
||||||
m_hiddenProperties.clear();
|
m_hiddenProperties.clear();
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
class QmlModelView;
|
class AbstractView;
|
||||||
class ModelNode;
|
class ModelNode;
|
||||||
|
|
||||||
class NavigatorTreeModel : public QStandardItemModel
|
class NavigatorTreeModel : public QStandardItemModel
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
int column,
|
int column,
|
||||||
const QModelIndex &parent);
|
const QModelIndex &parent);
|
||||||
|
|
||||||
void setView(QmlModelView *view);
|
void setView(AbstractView *view);
|
||||||
void clearView();
|
void clearView();
|
||||||
|
|
||||||
QModelIndex indexForNode(const ModelNode &node) const;
|
QModelIndex indexForNode(const ModelNode &node) const;
|
||||||
@@ -140,7 +140,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
QHash<ModelNode, ItemRow> m_nodeItemHash;
|
QHash<ModelNode, ItemRow> m_nodeItemHash;
|
||||||
QHash<uint, ModelNode> m_nodeHash;
|
QHash<uint, ModelNode> m_nodeHash;
|
||||||
QWeakPointer<QmlModelView> m_view;
|
QWeakPointer<AbstractView> m_view;
|
||||||
|
|
||||||
bool m_blockItemChangedSignal;
|
bool m_blockItemChangedSignal;
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <qmlitemnode.h>
|
||||||
|
|
||||||
static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPointF &pos)
|
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 {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
NavigatorView::NavigatorView(QObject* parent) :
|
NavigatorView::NavigatorView(QObject* parent) :
|
||||||
QmlModelView(parent),
|
AbstractView(parent),
|
||||||
m_blockSelectionChangedSignal(false),
|
m_blockSelectionChangedSignal(false),
|
||||||
m_widget(new NavigatorWidget(this)),
|
m_widget(new NavigatorWidget(this)),
|
||||||
m_treeModel(new NavigatorTreeModel(this))
|
m_treeModel(new NavigatorTreeModel(this))
|
||||||
@@ -114,7 +115,7 @@ WidgetInfo NavigatorView::widgetInfo()
|
|||||||
|
|
||||||
void NavigatorView::modelAttached(Model *model)
|
void NavigatorView::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
QmlModelView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
|
|
||||||
m_treeModel->setView(this);
|
m_treeModel->setView(this);
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ void NavigatorView::modelAttached(Model *model)
|
|||||||
void NavigatorView::modelAboutToBeDetached(Model *model)
|
void NavigatorView::modelAboutToBeDetached(Model *model)
|
||||||
{
|
{
|
||||||
m_treeModel->clearView();
|
m_treeModel->clearView();
|
||||||
QmlModelView::modelAboutToBeDetached(model);
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigatorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
void NavigatorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef NAVIGATORVIEW_H
|
#ifndef NAVIGATORVIEW_H
|
||||||
#define NAVIGATORVIEW_H
|
#define NAVIGATORVIEW_H
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
|
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ class NavigatorTreeModel;
|
|||||||
class IconCheckboxItemDelegate;
|
class IconCheckboxItemDelegate;
|
||||||
class IdItemDelegate;
|
class IdItemDelegate;
|
||||||
|
|
||||||
class NavigatorView : public QmlModelView
|
class NavigatorView : public AbstractView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -333,7 +333,7 @@ void PropertyEditor::NodeType::initialSetup(const TypeName &typeName, const QUrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertyEditor::PropertyEditor(QWidget *parent) :
|
PropertyEditor::PropertyEditor(QWidget *parent) :
|
||||||
QmlModelView(parent),
|
AbstractView(parent),
|
||||||
m_parent(parent),
|
m_parent(parent),
|
||||||
m_updateShortcut(0),
|
m_updateShortcut(0),
|
||||||
m_timerId(0),
|
m_timerId(0),
|
||||||
@@ -814,7 +814,7 @@ void PropertyEditor::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
|||||||
|
|
||||||
void PropertyEditor::modelAttached(Model *model)
|
void PropertyEditor::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
QmlModelView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
@@ -834,7 +834,7 @@ void PropertyEditor::modelAttached(Model *model)
|
|||||||
|
|
||||||
void PropertyEditor::modelAboutToBeDetached(Model *model)
|
void PropertyEditor::modelAboutToBeDetached(Model *model)
|
||||||
{
|
{
|
||||||
QmlModelView::modelAboutToBeDetached(model);
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
m_currentType->m_propertyEditorTransaction->end();
|
m_currentType->m_propertyEditorTransaction->end();
|
||||||
|
|
||||||
resetView();
|
resetView();
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef PROPERTYEDITOR_H
|
#ifndef PROPERTYEDITOR_H
|
||||||
#define PROPERTYEDITOR_H
|
#define PROPERTYEDITOR_H
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
#include <declarativewidgetview.h>
|
#include <declarativewidgetview.h>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
@@ -55,7 +55,7 @@ class PropertyEditorTransaction;
|
|||||||
class CollapseButton;
|
class CollapseButton;
|
||||||
class StackedWidget;
|
class StackedWidget;
|
||||||
|
|
||||||
class PropertyEditor: public QmlModelView
|
class PropertyEditor: public AbstractView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -41,6 +41,8 @@
|
|||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
|
|
||||||
|
#include <qmlitemnode.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +50,7 @@ namespace QmlDesigner {
|
|||||||
the current state is the base state, we render the base state + all other states.
|
the current state is the base state, we render the base state + all other states.
|
||||||
*/
|
*/
|
||||||
StatesEditorView::StatesEditorView(QObject *parent) :
|
StatesEditorView::StatesEditorView(QObject *parent) :
|
||||||
QmlModelView(parent),
|
AbstractView(parent),
|
||||||
m_statesEditorModel(new StatesEditorModel(this)),
|
m_statesEditorModel(new StatesEditorModel(this)),
|
||||||
m_statesEditorWidget(new StatesEditorWidget(this, m_statesEditorModel.data())),
|
m_statesEditorWidget(new StatesEditorWidget(this, m_statesEditorModel.data())),
|
||||||
m_lastIndex(-1)
|
m_lastIndex(-1)
|
||||||
@@ -304,11 +306,11 @@ void StatesEditorView::renameState(int nodeId, const QString &newName)
|
|||||||
|
|
||||||
void StatesEditorView::modelAttached(Model *model)
|
void StatesEditorView::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
if (model == QmlModelView::model())
|
if (model == AbstractView::model())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_ASSERT(model);
|
Q_ASSERT(model);
|
||||||
QmlModelView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
|
|
||||||
if (m_statesEditorWidget)
|
if (m_statesEditorWidget)
|
||||||
m_statesEditorWidget->setNodeInstanceView(nodeInstanceView());
|
m_statesEditorWidget->setNodeInstanceView(nodeInstanceView());
|
||||||
@@ -318,7 +320,7 @@ void StatesEditorView::modelAttached(Model *model)
|
|||||||
|
|
||||||
void StatesEditorView::modelAboutToBeDetached(Model *model)
|
void StatesEditorView::modelAboutToBeDetached(Model *model)
|
||||||
{
|
{
|
||||||
QmlModelView::modelAboutToBeDetached(model);
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
resetModel();
|
resetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,7 +30,9 @@
|
|||||||
#ifndef STATESEDITORVIEW_H
|
#ifndef STATESEDITORVIEW_H
|
||||||
#define STATESEDITORVIEW_H
|
#define STATESEDITORVIEW_H
|
||||||
|
|
||||||
#include <qmlmodelview.h>
|
#include <abstractview.h>
|
||||||
|
|
||||||
|
#include <qmlstate.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@ namespace QmlDesigner {
|
|||||||
class StatesEditorModel;
|
class StatesEditorModel;
|
||||||
class StatesEditorWidget;
|
class StatesEditorWidget;
|
||||||
|
|
||||||
class StatesEditorView : public QmlModelView {
|
class StatesEditorView : public AbstractView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -74,7 +76,7 @@ public:
|
|||||||
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;
|
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
// QmlModelView
|
// AbstractView
|
||||||
void actualStateChanged(const ModelNode &node) QTC_OVERRIDE;
|
void actualStateChanged(const ModelNode &node) QTC_OVERRIDE;
|
||||||
|
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) 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/plaintexteditmodifier.cpp \
|
||||||
$$PWD/model/componenttextmodifier.cpp \
|
$$PWD/model/componenttextmodifier.cpp \
|
||||||
$$PWD/model/textmodifier.cpp \
|
$$PWD/model/textmodifier.cpp \
|
||||||
$$PWD/model/qmlmodelview.cpp \
|
|
||||||
$$PWD/model/qmlitemnode.cpp \
|
$$PWD/model/qmlitemnode.cpp \
|
||||||
$$PWD/model/qmlstate.cpp \
|
$$PWD/model/qmlstate.cpp \
|
||||||
$$PWD/model/qmlchangeset.cpp \
|
$$PWD/model/qmlchangeset.cpp \
|
||||||
@@ -129,7 +128,6 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
|
|||||||
$$PWD/include/textmodifier.h \
|
$$PWD/include/textmodifier.h \
|
||||||
$$PWD/model/modeltotextmerger.h \
|
$$PWD/model/modeltotextmerger.h \
|
||||||
$$PWD/model/texttomodelmerger.h \
|
$$PWD/model/texttomodelmerger.h \
|
||||||
$$PWD/include/qmlmodelview.h \
|
|
||||||
$$PWD/include/qmlitemnode.h \
|
$$PWD/include/qmlitemnode.h \
|
||||||
$$PWD/include/qmlstate.h \
|
$$PWD/include/qmlstate.h \
|
||||||
$$PWD/include/qmlchangeset.h \
|
$$PWD/include/qmlchangeset.h \
|
||||||
|
@@ -55,7 +55,6 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QmlModelView;
|
|
||||||
class NodeInstanceView;
|
class NodeInstanceView;
|
||||||
class RewriterView;
|
class RewriterView;
|
||||||
|
|
||||||
@@ -228,7 +227,6 @@ public:
|
|||||||
|
|
||||||
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) = 0;
|
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) = 0;
|
||||||
|
|
||||||
QmlModelView *toQmlModelView();
|
|
||||||
|
|
||||||
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
|
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
|
||||||
|
|
||||||
|
@@ -35,7 +35,8 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QmlModelView;
|
class AbstractView;
|
||||||
|
class NodeInstanceView;
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT QmlModelNodeFacade
|
class QMLDESIGNERCORE_EXPORT QmlModelNodeFacade
|
||||||
{
|
{
|
||||||
@@ -48,9 +49,10 @@ public:
|
|||||||
virtual ~QmlModelNodeFacade();
|
virtual ~QmlModelNodeFacade();
|
||||||
QmlModelNodeFacade();
|
QmlModelNodeFacade();
|
||||||
|
|
||||||
bool isRootNode() const;
|
AbstractView *view() const;
|
||||||
static QmlModelView* qmlModelView();
|
static NodeInstanceView *nodeInstanceView();
|
||||||
|
|
||||||
|
bool isRootNode() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QmlModelNodeFacade(const ModelNode &modelNode);
|
QmlModelNodeFacade(const ModelNode &modelNode);
|
||||||
|
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** 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 {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QmlModelView;
|
class AbstractViewAbstractVieweGroup;
|
||||||
class QmlModelStateGroup;
|
|
||||||
class QmlObjectNode;
|
class QmlObjectNode;
|
||||||
|
class QmlModelStateGroup;
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade
|
class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addChangeSetIfNotExists(const ModelNode &node);
|
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 pushInFileComponentOnCrambleBar(const QString &componentId);
|
||||||
void nextFileIsCalledInternally();
|
void nextFileIsCalledInternally();
|
||||||
|
|
||||||
//used by DesignDocument ### find a better solution
|
NodeInstanceView *nodeInstanceView();
|
||||||
QmlModelView *qmlModelView();
|
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
Q_DISABLE_COPY(ViewManager)
|
Q_DISABLE_COPY(ViewManager)
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "model_p.h"
|
#include "model_p.h"
|
||||||
#include "internalnode_p.h"
|
#include "internalnode_p.h"
|
||||||
#include <qmlmodelview.h>
|
#include "nodeinstanceview.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -399,11 +399,6 @@ bool AbstractView::hasModelNodeForInternalId(qint32 internalId) const
|
|||||||
return model()->d->hasNodeForInternalId(internalId);
|
return model()->d->hasNodeForInternalId(internalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlModelView *AbstractView::toQmlModelView()
|
|
||||||
{
|
|
||||||
return qobject_cast<QmlModelView*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeInstanceView *AbstractView::nodeInstanceView() const
|
NodeInstanceView *AbstractView::nodeInstanceView() const
|
||||||
{
|
{
|
||||||
if (model())
|
if (model())
|
||||||
|
@@ -84,17 +84,15 @@ const QList<ModelNode> NodeListProperty::toModelNodeList() const
|
|||||||
|
|
||||||
const QList<QmlObjectNode> NodeListProperty::toQmlObjectNodeList() const
|
const QList<QmlObjectNode> NodeListProperty::toQmlObjectNodeList() const
|
||||||
{
|
{
|
||||||
QmlModelView *fxView = view()->toQmlModelView();
|
if (model()->nodeInstanceView())
|
||||||
|
|
||||||
if (fxView == 0)
|
|
||||||
return QList<QmlObjectNode>();
|
return QList<QmlObjectNode>();
|
||||||
|
|
||||||
QList<QmlObjectNode> fxObjectNodeList;
|
QList<QmlObjectNode> qmlObjectNodeList;
|
||||||
|
|
||||||
foreach (const ModelNode &modelNode, toModelNodeList())
|
foreach (const ModelNode &modelNode, toModelNodeList())
|
||||||
fxObjectNodeList.append(QmlObjectNode(modelNode));
|
qmlObjectNodeList.append(QmlObjectNode(modelNode));
|
||||||
|
|
||||||
return fxObjectNodeList;
|
return qmlObjectNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::slide(int from, int to) const
|
void NodeListProperty::slide(int from, int to) const
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "nodeabstractproperty.h"
|
#include "nodeabstractproperty.h"
|
||||||
#include "rewritertransaction.h"
|
#include "rewritertransaction.h"
|
||||||
#include "qmlmodelview.h"
|
#include "nodeinstanceview.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ void QmlAnchors::setAnchor(AnchorLine::Type sourceAnchorLine,
|
|||||||
const QmlItemNode &targetQmlItemNode,
|
const QmlItemNode &targetQmlItemNode,
|
||||||
AnchorLine::Type targetAnchorLine)
|
AnchorLine::Type targetAnchorLine)
|
||||||
{
|
{
|
||||||
RewriterTransaction transaction = qmlItemNode().qmlModelView()->beginRewriterTransaction();
|
RewriterTransaction transaction = qmlItemNode().view()->beginRewriterTransaction();
|
||||||
if (qmlItemNode().isInBaseState()) {
|
if (qmlItemNode().isInBaseState()) {
|
||||||
if ((qmlItemNode().nodeInstance().hasAnchor("anchors.fill") && (sourceAnchorLine & AnchorLine::Fill))
|
if ((qmlItemNode().nodeInstance().hasAnchor("anchors.fill") && (sourceAnchorLine & AnchorLine::Fill))
|
||||||
|| ((qmlItemNode().nodeInstance().hasAnchor("anchors.centerIn") && (sourceAnchorLine & AnchorLine::Center)))) {
|
|| ((qmlItemNode().nodeInstance().hasAnchor("anchors.centerIn") && (sourceAnchorLine & AnchorLine::Center)))) {
|
||||||
@@ -277,12 +277,12 @@ AnchorLine QmlAnchors::instanceAnchor(AnchorLine::Type sourceAnchorLine) const
|
|||||||
if (targetAnchorLinePair.second < 0) //there might be no node instance for the parent
|
if (targetAnchorLinePair.second < 0) //there might be no node instance for the parent
|
||||||
return AnchorLine();
|
return AnchorLine();
|
||||||
|
|
||||||
return AnchorLine(QmlItemNode(qmlItemNode().nodeForInstance(qmlItemNode().qmlModelView()->nodeInstanceView()->instanceForId(targetAnchorLinePair.second))), targetAnchorLine);
|
return AnchorLine(QmlItemNode(qmlItemNode().nodeForInstance(qmlItemNode().nodeInstanceView()->instanceForId(targetAnchorLinePair.second))), targetAnchorLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlAnchors::removeAnchor(AnchorLine::Type sourceAnchorLine)
|
void QmlAnchors::removeAnchor(AnchorLine::Type sourceAnchorLine)
|
||||||
{
|
{
|
||||||
RewriterTransaction transaction = qmlItemNode().qmlModelView()->beginRewriterTransaction();
|
RewriterTransaction transaction = qmlItemNode().view()->beginRewriterTransaction();
|
||||||
if (qmlItemNode().isInBaseState()) {
|
if (qmlItemNode().isInBaseState()) {
|
||||||
const PropertyName propertyName = anchorPropertyName(sourceAnchorLine);
|
const PropertyName propertyName = anchorPropertyName(sourceAnchorLine);
|
||||||
if (qmlItemNode().nodeInstance().hasAnchor("anchors.fill") && (sourceAnchorLine & AnchorLine::Fill)) {
|
if (qmlItemNode().nodeInstance().hasAnchor("anchors.fill") && (sourceAnchorLine & AnchorLine::Fill)) {
|
||||||
@@ -304,7 +304,7 @@ void QmlAnchors::removeAnchor(AnchorLine::Type sourceAnchorLine)
|
|||||||
|
|
||||||
void QmlAnchors::removeAnchors()
|
void QmlAnchors::removeAnchors()
|
||||||
{
|
{
|
||||||
RewriterTransaction transaction = qmlItemNode().qmlModelView()->beginRewriterTransaction();
|
RewriterTransaction transaction = qmlItemNode().view()->beginRewriterTransaction();
|
||||||
if (qmlItemNode().nodeInstance().hasAnchor("anchors.fill"))
|
if (qmlItemNode().nodeInstance().hasAnchor("anchors.fill"))
|
||||||
qmlItemNode().modelNode().removeProperty("anchors.fill");
|
qmlItemNode().modelNode().removeProperty("anchors.fill");
|
||||||
if (qmlItemNode().nodeInstance().hasAnchor("anchors.centerIn"))
|
if (qmlItemNode().nodeInstance().hasAnchor("anchors.centerIn"))
|
||||||
@@ -492,7 +492,7 @@ void QmlAnchors::removeMargin(AnchorLine::Type sourceAnchorLineType)
|
|||||||
|
|
||||||
void QmlAnchors::removeMargins()
|
void QmlAnchors::removeMargins()
|
||||||
{
|
{
|
||||||
RewriterTransaction transaction = qmlItemNode().qmlModelView()->beginRewriterTransaction();
|
RewriterTransaction transaction = qmlItemNode().view()->beginRewriterTransaction();
|
||||||
removeMargin(AnchorLine::Left);
|
removeMargin(AnchorLine::Left);
|
||||||
removeMargin(AnchorLine::Right);
|
removeMargin(AnchorLine::Right);
|
||||||
removeMargin(AnchorLine::Top);
|
removeMargin(AnchorLine::Top);
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#include "qmlchangeset.h"
|
#include "qmlchangeset.h"
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "variantproperty.h"
|
#include "variantproperty.h"
|
||||||
#include "qmlmodelview.h"
|
#include "abstractview.h"
|
||||||
#include <metainfo.h>
|
#include <metainfo.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -72,7 +72,7 @@ bool QmlModelStateOperation::isValidQmlModelStateOperation(const ModelNode &mode
|
|||||||
|
|
||||||
void QmlPropertyChanges::removeProperty(const PropertyName &name)
|
void QmlPropertyChanges::removeProperty(const PropertyName &name)
|
||||||
{
|
{
|
||||||
RewriterTransaction transaction(qmlModelView()->beginRewriterTransaction());
|
RewriterTransaction transaction(view()->beginRewriterTransaction());
|
||||||
if (name == "name")
|
if (name == "name")
|
||||||
return;
|
return;
|
||||||
modelNode().removeProperty(name);
|
modelNode().removeProperty(name);
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#include "variantproperty.h"
|
#include "variantproperty.h"
|
||||||
#include "qmlanchors.h"
|
#include "qmlanchors.h"
|
||||||
#include "invalidmodelnodeexception.h"
|
#include "invalidmodelnodeexception.h"
|
||||||
#include "qmlmodelview.h"
|
|
||||||
#include "itemlibraryinfo.h"
|
#include "itemlibraryinfo.h"
|
||||||
|
|
||||||
#include "plaintexteditmodifier.h"
|
#include "plaintexteditmodifier.h"
|
||||||
|
@@ -28,14 +28,27 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlmodelnodefacade.h"
|
#include "qmlmodelnodefacade.h"
|
||||||
#include "qmlmodelview.h"
|
#include "nodeinstanceview.h"
|
||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
#include <QDebug>
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
QmlModelNodeFacade::QmlModelNodeFacade() : m_modelNode(ModelNode())
|
QmlModelNodeFacade::QmlModelNodeFacade() : m_modelNode(ModelNode())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
AbstractView *QmlModelNodeFacade::view() const
|
||||||
|
{
|
||||||
|
if (modelNode().isValid())
|
||||||
|
return modelNode().view();
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeInstanceView *QmlModelNodeFacade::nodeInstanceView()
|
||||||
|
{
|
||||||
|
return QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QmlModelNodeFacade::QmlModelNodeFacade(const ModelNode &modelNode) : m_modelNode(modelNode)
|
QmlModelNodeFacade::QmlModelNodeFacade(const ModelNode &modelNode) : m_modelNode(modelNode)
|
||||||
{}
|
{}
|
||||||
@@ -63,18 +76,12 @@ bool QmlModelNodeFacade::isValid() const
|
|||||||
return isValidQmlModelNodeFacade(m_modelNode);
|
return isValidQmlModelNodeFacade(m_modelNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlModelView* QmlModelNodeFacade::qmlModelView()
|
|
||||||
{
|
|
||||||
return QmlDesignerPlugin::instance()->viewManager().qmlModelView();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmlModelNodeFacade::isValidQmlModelNodeFacade(const ModelNode &modelNode)
|
bool QmlModelNodeFacade::isValidQmlModelNodeFacade(const ModelNode &modelNode)
|
||||||
{
|
{
|
||||||
return modelNode.isValid()
|
return modelNode.isValid()
|
||||||
&& qmlModelView()
|
&& nodeInstanceView()
|
||||||
&& qmlModelView()->nodeInstanceView()
|
&& nodeInstanceView()->hasInstanceForNode(modelNode)
|
||||||
&& qmlModelView()->nodeInstanceView()->hasInstanceForNode(modelNode)
|
&& nodeInstanceView()->instanceForModelNode(modelNode).isValid();
|
||||||
&& qmlModelView()->nodeInstanceView()->instanceForModelNode(modelNode).isValid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlModelNodeFacade::isRootNode() const
|
bool QmlModelNodeFacade::isRootNode() const
|
||||||
|
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qmlmodelview.h"
|
|
||||||
#include "qmlobjectnode.h"
|
|
||||||
#include "qmlitemnode.h"
|
|
||||||
#include "itemlibraryinfo.h"
|
|
||||||
#include "mathutils.h"
|
|
||||||
#include "invalididexception.h"
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
#include "nodeabstractproperty.h"
|
|
||||||
#include "variantproperty.h"
|
|
||||||
#include "rewritingexception.h"
|
|
||||||
#include "rewriterview.h"
|
|
||||||
#include "plaintexteditmodifier.h"
|
|
||||||
#include "modelmerger.h"
|
|
||||||
#include "nodemetainfo.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
QmlModelView::QmlModelView(QObject *parent)
|
|
||||||
: AbstractView(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
} //QmlDesigner
|
|
@@ -33,11 +33,12 @@
|
|||||||
#include "variantproperty.h"
|
#include "variantproperty.h"
|
||||||
#include "nodeproperty.h"
|
#include "nodeproperty.h"
|
||||||
#include <invalidmodelnodeexception.h>
|
#include <invalidmodelnodeexception.h>
|
||||||
#include "qmlmodelview.h"
|
#include "abstractview.h"
|
||||||
#include "nodeinstance.h"
|
#include "nodeinstance.h"
|
||||||
#include "nodemetainfo.h"
|
#include "nodemetainfo.h"
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "nodelistproperty.h"
|
#include "nodelistproperty.h"
|
||||||
|
#include "nodeinstanceview.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ void QmlObjectNode::setBindingProperty(const PropertyName &name, const QString &
|
|||||||
QmlModelState QmlObjectNode::currentState() const
|
QmlModelState QmlObjectNode::currentState() const
|
||||||
{
|
{
|
||||||
if (isValid())
|
if (isValid())
|
||||||
return QmlModelState(qmlModelView()->actualStateNode());
|
return QmlModelState(view()->actualStateNode());
|
||||||
else
|
else
|
||||||
return QmlModelState();
|
return QmlModelState();
|
||||||
}
|
}
|
||||||
@@ -345,8 +346,8 @@ QList<QmlModelState> QmlObjectNode::allDefinedStates() const
|
|||||||
|
|
||||||
QList<QmlItemNode> allQmlItems;
|
QList<QmlItemNode> allQmlItems;
|
||||||
|
|
||||||
if (QmlItemNode::isValidQmlItemNode(qmlModelView()->rootModelNode()))
|
if (QmlItemNode::isValidQmlItemNode(view()->rootModelNode()))
|
||||||
allQmlItems.append(allQmlItemsRecursive(qmlModelView()->rootModelNode()));
|
allQmlItems.append(allQmlItemsRecursive(view()->rootModelNode()));
|
||||||
|
|
||||||
foreach (const QmlItemNode &item, allQmlItems) {
|
foreach (const QmlItemNode &item, allQmlItems) {
|
||||||
returnList.append(item.states().allStates());
|
returnList.append(item.states().allStates());
|
||||||
@@ -419,26 +420,22 @@ TypeName QmlObjectNode::instanceType(const PropertyName &name) const
|
|||||||
|
|
||||||
bool QmlObjectNode::instanceHasBinding(const PropertyName &name) const
|
bool QmlObjectNode::instanceHasBinding(const PropertyName &name) const
|
||||||
{
|
{
|
||||||
QmlModelView *modelView = qobject_cast<QmlModelView*>(modelNode().view());
|
|
||||||
if (!modelView)
|
|
||||||
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
|
|
||||||
|
|
||||||
return nodeInstance().hasBindingForProperty(name);
|
return nodeInstance().hasBindingForProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeInstance QmlObjectNode::nodeInstance() const
|
NodeInstance QmlObjectNode::nodeInstance() const
|
||||||
{
|
{
|
||||||
return qmlModelView()->nodeInstanceView()->instanceForModelNode(modelNode());
|
return nodeInstanceView()->instanceForModelNode(modelNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlObjectNode QmlObjectNode::nodeForInstance(const NodeInstance &instance) const
|
QmlObjectNode QmlObjectNode::nodeForInstance(const NodeInstance &instance) const
|
||||||
{
|
{
|
||||||
return QmlObjectNode(ModelNode(instance.modelNode(), qmlModelView()));
|
return QmlObjectNode(ModelNode(instance.modelNode(), view()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlItemNode QmlObjectNode::itemForInstance(const NodeInstance &instance) const
|
QmlItemNode QmlObjectNode::itemForInstance(const NodeInstance &instance) const
|
||||||
{
|
{
|
||||||
return QmlItemNode(ModelNode(instance.modelNode(), qmlModelView()));
|
return QmlItemNode(ModelNode(instance.modelNode(), view()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlObjectNode::QmlObjectNode()
|
QmlObjectNode::QmlObjectNode()
|
||||||
@@ -468,14 +465,14 @@ bool QmlObjectNode::hasNodeParent() const
|
|||||||
|
|
||||||
bool QmlObjectNode::hasInstanceParent() const
|
bool QmlObjectNode::hasInstanceParent() const
|
||||||
{
|
{
|
||||||
return nodeInstance().parentId() >= 0 && qmlModelView()->nodeInstanceView()->hasInstanceForId(nodeInstance().parentId());
|
return nodeInstance().parentId() >= 0 && nodeInstanceView()->hasInstanceForId(nodeInstance().parentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlObjectNode::hasInstanceParentItem() const
|
bool QmlObjectNode::hasInstanceParentItem() const
|
||||||
{
|
{
|
||||||
return nodeInstance().parentId() >= 0
|
return nodeInstance().parentId() >= 0
|
||||||
&& qmlModelView()->nodeInstanceView()->hasInstanceForId(nodeInstance().parentId())
|
&& nodeInstanceView()->hasInstanceForId(nodeInstance().parentId())
|
||||||
&& QmlItemNode::isItemOrWindow(qmlModelView()->modelNodeForInternalId(nodeInstance().parentId()));
|
&& QmlItemNode::isItemOrWindow(view()->modelNodeForInternalId(nodeInstance().parentId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -487,7 +484,7 @@ void QmlObjectNode::setParentProperty(const NodeAbstractProperty &parentProeprty
|
|||||||
QmlObjectNode QmlObjectNode::instanceParent() const
|
QmlObjectNode QmlObjectNode::instanceParent() const
|
||||||
{
|
{
|
||||||
if (hasInstanceParent())
|
if (hasInstanceParent())
|
||||||
return nodeForInstance(qmlModelView()->nodeInstanceView()->instanceForId(nodeInstance().parentId()));
|
return nodeForInstance(nodeInstanceView()->instanceForId(nodeInstance().parentId()));
|
||||||
|
|
||||||
return QmlObjectNode();
|
return QmlObjectNode();
|
||||||
}
|
}
|
||||||
@@ -495,7 +492,7 @@ QmlObjectNode QmlObjectNode::instanceParent() const
|
|||||||
QmlItemNode QmlObjectNode::instanceParentItem() const
|
QmlItemNode QmlObjectNode::instanceParentItem() const
|
||||||
{
|
{
|
||||||
if (hasInstanceParentItem())
|
if (hasInstanceParentItem())
|
||||||
return itemForInstance(qmlModelView()->nodeInstanceView()->instanceForId(nodeInstance().parentId()));
|
return itemForInstance(nodeInstanceView()->instanceForId(nodeInstance().parentId()));
|
||||||
|
|
||||||
return QmlItemNode();
|
return QmlItemNode();
|
||||||
}
|
}
|
||||||
|
@@ -28,12 +28,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlstate.h"
|
#include "qmlstate.h"
|
||||||
#include "qmlmodelview.h"
|
#include "abstractview.h"
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <metainfo.h>
|
#include <metainfo.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
#include <invalidmodelnodeexception.h>
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
|
#include "qmlchangeset.h"
|
||||||
|
#include "qmlitemnode.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -180,7 +182,7 @@ void QmlModelState::addChangeSetIfNotExists(const ModelNode &node)
|
|||||||
return; //changeSet already there
|
return; //changeSet already there
|
||||||
|
|
||||||
ModelNode newChangeSet;
|
ModelNode newChangeSet;
|
||||||
if (qmlModelView()->majorQtQuickVersion() > 1)
|
if (view()->majorQtQuickVersion() > 1)
|
||||||
newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 2, 0);
|
newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 2, 0);
|
||||||
else
|
else
|
||||||
newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 1, 0);
|
newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 1, 0);
|
||||||
@@ -295,9 +297,9 @@ QmlModelState QmlModelState::duplicate(const QString &name) const
|
|||||||
// QmlModelState newState(stateGroup().addState(name));
|
// QmlModelState newState(stateGroup().addState(name));
|
||||||
PropertyListType propertyList;
|
PropertyListType propertyList;
|
||||||
propertyList.append(qMakePair(PropertyName("name"), QVariant(name)));
|
propertyList.append(qMakePair(PropertyName("name"), QVariant(name)));
|
||||||
QmlModelState newState(createQmlState(qmlModelView(), propertyList));
|
QmlModelState newState(createQmlState(view(), propertyList));
|
||||||
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
|
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
|
||||||
ModelNode newModelNode(qmlModelView()->createModelNode(childNode.type(), childNode.majorVersion(), childNode.minorVersion()));
|
ModelNode newModelNode(view()->createModelNode(childNode.type(), childNode.majorVersion(), childNode.minorVersion()));
|
||||||
foreach (const BindingProperty &bindingProperty, childNode.bindingProperties())
|
foreach (const BindingProperty &bindingProperty, childNode.bindingProperties())
|
||||||
newModelNode.bindingProperty(bindingProperty.name()).setExpression(bindingProperty.expression());
|
newModelNode.bindingProperty(bindingProperty.name()).setExpression(bindingProperty.expression());
|
||||||
foreach (const VariantProperty &variantProperty, childNode.variantProperties())
|
foreach (const VariantProperty &variantProperty, childNode.variantProperties())
|
||||||
@@ -326,11 +328,11 @@ ModelNode QmlModelState::createQmlState(AbstractView *view, const PropertyListTy
|
|||||||
return view->createModelNode("QtQuick.State", 1, 0, propertyList);
|
return view->createModelNode("QtQuick.State", 1, 0, propertyList);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlModelState QmlModelState::createBaseState(const QmlModelView *view)
|
QmlModelState QmlModelState::createBaseState(const AbstractView *view)
|
||||||
{
|
{
|
||||||
QmlModelState fxState(view->rootModelNode());
|
QmlModelState qmlModelState(view->rootModelNode());
|
||||||
|
|
||||||
return fxState;
|
return qmlModelState;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // QmlDesigner
|
} // QmlDesigner
|
||||||
|
@@ -223,10 +223,10 @@ void ViewManager::nextFileIsCalledInternally()
|
|||||||
m_formEditorView.formEditorWidget()->formEditorCrumbleBar()->nextFileIsCalledInternally();
|
m_formEditorView.formEditorWidget()->formEditorCrumbleBar()->nextFileIsCalledInternally();
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlModelView *ViewManager::qmlModelView()
|
NodeInstanceView *ViewManager::nodeInstanceView()
|
||||||
{
|
{
|
||||||
return &m_formEditorView;
|
return &m_nodeInstanceView;
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *ViewManager::currentModel() const
|
Model *ViewManager::currentModel() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user