Commit 6fc26463 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlDesigner: Cleanup of NodeInstanceView

Reviewed-by: Marco Bubke
parent 12ef2e84
......@@ -401,7 +401,6 @@ QPixmap StatesEditorView::renderState(int i)
return QPixmap();
Q_ASSERT(i >= 0 && i < m_modelStates.size());
nodeInstanceView()->setBlockChangeSignal(true);
QmlModelState oldState = currentState();
setCurrentStateSilent(i);
......@@ -430,7 +429,6 @@ QPixmap StatesEditorView::renderState(int i)
nodeInstanceView()->render(&painter, pixmap.rect(), nodeInstanceView()->sceneRect());
setCurrentState(m_modelStates.indexOf(oldState));
nodeInstanceView()->setBlockChangeSignal(false);
Q_ASSERT(oldState == currentState());
......
......@@ -27,25 +27,20 @@
**
**************************************************************************/
#ifndef ABSTRACTNODEINSTANCEVIEW_H
#define ABSTRACTNODEINSTANCEVIEW_H
#ifndef NODEINSTANCEVIEW_H
#define NODEINSTANCEVIEW_H
#include "corelib_global.h"
#include "abstractview.h"
#include <QtGui/QWidget>
#include <QtCore/QHash>
#include <QtScript/QScriptEngine>
#include <QWeakPointer>
#include <QtCore/QHash>
#include <modelnode.h>
#include <nodeinstance.h>
QT_BEGIN_NAMESPACE
#include <QHash>
#include <QWeakPointer>
class QDeclarativeEngine;
class QGraphicsScene;
class QGraphicsView;
QT_END_NAMESPACE
namespace QmlDesigner {
......@@ -61,6 +56,7 @@ class CORESHARED_EXPORT NodeInstanceView : public AbstractView
friend class NodeInstance;
friend class Internal::ObjectNodeInstance;
friend class Internal::QmlStateNodeInstance;
public:
typedef QWeakPointer<NodeInstanceView> Pointer;
......@@ -79,21 +75,9 @@ public:
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
void fileUrlChanged(const QUrl &oldUrl, const QUrl &newUrl);
void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
void modelStateAboutToBeRemoved(const ModelState &modelState);
void modelStateAdded(const ModelState &modelState);
void nodeStatesAboutToBeRemoved(const QList<ModelNode> &nodeStateList);
void nodeStatesAdded(const QList<ModelNode> &nodeStateList);
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
NodeInstance rootNodeInstance() const;
NodeInstance viewNodeInstance() const;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
QList<NodeInstance> instances() const;
......@@ -103,13 +87,9 @@ public:
NodeInstance instanceForObject(QObject *object);
bool hasInstanceForObject(QObject *object);
void anchorsChanged(const ModelNode &nodeState);
void render(QPainter *painter, const QRectF &target=QRectF(), const QRectF &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio);
QRectF boundingRect() const;
QRectF sceneRect() const;
void setBlockChangeSignal(bool block);
void notifyPropertyChange(const ModelNode &modelNode, const QString &propertyName);
......@@ -123,13 +103,12 @@ public:
void activateState(const NodeInstance &instance);
void activateBaseState();
signals:
void instanceRemoved(const NodeInstance &nodeInstance);
private slots:
void emitParentChanged(QObject *child);
private: // functions
NodeInstance rootNodeInstance() const;
NodeInstance loadNode(const ModelNode &rootNode, QObject *objectToBeWrapped = 0);
void loadModel(Model *model);
void loadNodes(const QList<ModelNode> &nodeList);
......@@ -164,10 +143,9 @@ private: //variables
QWeakPointer<QmlModelView> m_qmlModelView;
bool m_blockChangeSignal;
bool m_blockStatePropertyChanges;
};
}
} // namespace NodeInstanceView
#endif // ABSTRACTNODEINSTANCEVIEW_H
#endif // NODEINSTANCEVIEW_H
......@@ -92,7 +92,6 @@ NodeInstanceView::NodeInstanceView(QObject *parent)
: AbstractView(parent),
m_graphicsView(new QGraphicsView),
m_engine(new QDeclarativeEngine(this)),
m_blockChangeSignal(false),
m_blockStatePropertyChanges(false)
{
m_graphicsView->setAttribute(Qt::WA_DontShowOnScreen, true);
......@@ -550,7 +549,6 @@ void NodeInstanceView::removeInstanceNodeRelationship(const ModelNode &node)
NodeInstance instance = instanceForNode(node);
m_objectInstanceHash.remove(instanceForNode(node).internalObject());
m_nodeInstanceHash.remove(node);
emit instanceRemoved(instance);
instance.makeInvalid();
}
......@@ -655,13 +653,6 @@ void NodeInstanceView::render(QPainter * painter, const QRectF &target, const QR
}
}
QRectF NodeInstanceView::boundingRect() const
{
if (m_graphicsView)
return m_graphicsView->scene()->itemsBoundingRect();
return QRectF();
}
QRectF NodeInstanceView::sceneRect() const
{
if (m_graphicsView)
......@@ -670,9 +661,4 @@ QRectF NodeInstanceView::sceneRect() const
return QRectF();
}
void NodeInstanceView::setBlockChangeSignal(bool block)
{
m_blockChangeSignal = block;
}
}
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