| 
									
										
										
										
											2012-11-06 15:35:19 +01:00
										 |  |  | /****************************************************************************
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:59:14 +01:00
										 |  |  | ** Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-11-06 15:35:19 +01:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-11-06 15:35:19 +01:00
										 |  |  | ** 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 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:59:14 +01:00
										 |  |  | ** a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | ** and conditions see https://www.qt.io/terms-conditions. For further
 | 
					
						
							|  |  |  | ** information use the contact form at https://www.qt.io/contact-us.
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2015-09-18 11:34:48 +02:00
										 |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							| 
									
										
										
										
											2016-01-15 14:59:14 +01:00
										 |  |  | ** General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | ** included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | ** information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-11-06 15:35:19 +01:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-18 07:55:01 +01:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QSharedPointer>
 | 
					
						
							|  |  |  | #include <QHash>
 | 
					
						
							|  |  |  | #include <QRectF>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <nodeinstanceserverinterface.h>
 | 
					
						
							|  |  |  | #include <propertyvaluecontainer.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QT_BEGIN_NAMESPACE | 
					
						
							|  |  |  | class QPainter; | 
					
						
							|  |  |  | class QStyleOptionGraphicsItem; | 
					
						
							|  |  |  | class QQmlContext; | 
					
						
							|  |  |  | class QGraphicsItem; | 
					
						
							|  |  |  | class QGraphicsTransform; | 
					
						
							|  |  |  | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
 | 
					
						
							|  |  |  | class QQuickItem; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | QT_END_NAMESPACE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace QmlDesigner { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class NodeInstanceServer; | 
					
						
							|  |  |  | class Qt4NodeInstanceServer; | 
					
						
							|  |  |  | class Qt4PreviewNodeInstanceServer; | 
					
						
							|  |  |  | class Qt5NodeInstanceServer; | 
					
						
							|  |  |  | class Qt5PreviewNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2013-07-04 17:06:31 +02:00
										 |  |  | class Qt5TestNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | class InstanceContainer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  |     class ObjectNodeInstance; | 
					
						
							|  |  |  |     class QmlGraphicsItemNodeInstance; | 
					
						
							|  |  |  |     class QmlPropertyChangesNodeInstance; | 
					
						
							|  |  |  |     class GraphicsObjectNodeInstance; | 
					
						
							|  |  |  |     class QmlStateNodeInstance; | 
					
						
							|  |  |  |     class QuickItemNodeInstance; | 
					
						
							| 
									
										
										
										
											2019-11-25 17:10:59 +02:00
										 |  |  |     class Quick3DNodeInstance; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ServerNodeInstance | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     friend class NodeInstanceServer; | 
					
						
							|  |  |  |     friend class Qt4NodeInstanceServer; | 
					
						
							|  |  |  |     friend class Qt4PreviewNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2019-09-27 18:52:06 +02:00
										 |  |  |     friend class Qt5InformationNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     friend class Qt5NodeInstanceServer; | 
					
						
							|  |  |  |     friend class Qt5PreviewNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2013-07-04 17:06:31 +02:00
										 |  |  |     friend class Qt5TestNodeInstanceServer; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     friend class QHash<qint32, ServerNodeInstance>; | 
					
						
							|  |  |  |     friend uint qHash(const ServerNodeInstance &instance); | 
					
						
							|  |  |  |     friend bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second); | 
					
						
							|  |  |  |     friend QDebug operator<<(QDebug debug, const ServerNodeInstance &instance); | 
					
						
							|  |  |  |     friend class NodeMetaInfo; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::QmlGraphicsItemNodeInstance; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::QuickItemNodeInstance; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::GraphicsObjectNodeInstance; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::ObjectNodeInstance; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::QmlPropertyChangesNodeInstance; | 
					
						
							|  |  |  |     friend class QmlDesigner::Internal::QmlStateNodeInstance; | 
					
						
							| 
									
										
										
										
											2019-11-25 17:10:59 +02:00
										 |  |  |     friend class QmlDesigner::Internal::Quick3DNodeInstance; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     enum ComponentWrap { | 
					
						
							|  |  |  |         WrapAsComponent, | 
					
						
							|  |  |  |         DoNotWrapAsComponent | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ServerNodeInstance(); | 
					
						
							|  |  |  |     ~ServerNodeInstance(); | 
					
						
							|  |  |  |     ServerNodeInstance(const ServerNodeInstance &other); | 
					
						
							|  |  |  |     ServerNodeInstance& operator=(const ServerNodeInstance &other); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QImage renderImage() const; | 
					
						
							| 
									
										
										
										
											2013-04-15 13:28:48 +02:00
										 |  |  |     QImage renderPreviewImage(const QSize &previewImageSize) const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ServerNodeInstance parent() const; | 
					
						
							|  |  |  |     bool hasParent() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool equalGraphicsItem(QGraphicsItem *item) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QRectF boundingRect() const; | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  |     QRectF contentItemBoundingRect() const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     QPointF position() const; | 
					
						
							|  |  |  |     QSizeF size() const; | 
					
						
							|  |  |  |     QTransform transform() const; | 
					
						
							|  |  |  |     QTransform customTransform() const; | 
					
						
							|  |  |  |     QTransform sceneTransform() const; | 
					
						
							| 
									
										
										
										
											2013-05-22 13:07:32 +02:00
										 |  |  |     QTransform contentTransform() const; | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  |     QTransform contentItemTransform() const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     double rotation() const; | 
					
						
							|  |  |  |     double scale() const; | 
					
						
							|  |  |  |     QList<QGraphicsTransform *> transformations() const; | 
					
						
							|  |  |  |     QPointF transformOriginPoint() const; | 
					
						
							|  |  |  |     double zValue() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     double opacity() const; | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     QVariant property(const PropertyName &name) const; | 
					
						
							|  |  |  |     QVariant defaultValue(const PropertyName &name) const; | 
					
						
							|  |  |  |     QString instanceType(const PropertyName &name) const; | 
					
						
							|  |  |  |     PropertyNameList propertyNames() const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-31 17:21:41 +02:00
										 |  |  |     bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = nullptr) const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool isValid() const; | 
					
						
							|  |  |  |     void makeInvalid(); | 
					
						
							|  |  |  |     bool hasContent() const; | 
					
						
							|  |  |  |     bool isResizable() const; | 
					
						
							|  |  |  |     bool isMovable() const; | 
					
						
							| 
									
										
										
										
											2013-04-18 18:42:58 +02:00
										 |  |  |     bool isInLayoutable() const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool isSubclassOf(const QString &superTypeName) const; | 
					
						
							|  |  |  |     bool isRootNodeInstance() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool isWrappingThisObject(QObject *object) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     QVariant resetVariant(const PropertyName &name) const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     bool hasAnchor(const PropertyName &name) const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     bool isAnchoredBySibling() const; | 
					
						
							|  |  |  |     bool isAnchoredByChildren() const; | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     int penWidth() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static void registerQmlTypes(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void doComponentComplete(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<ServerNodeInstance> childItems() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-16 12:32:52 +02:00
										 |  |  |     QQuickItem *rootQuickItem() const; | 
					
						
							| 
									
										
										
										
											2014-04-16 12:33:50 +02:00
										 |  |  |     QList<QQuickItem *> allItemsRecursive() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     QString id() const; | 
					
						
							|  |  |  |     qint32 instanceId() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QSharedPointer<Internal::ObjectNodeInstance> internalInstance() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<ServerNodeInstance> stateInstances() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-27 18:52:06 +02:00
										 |  |  |     static bool isSubclassOf(QObject *object, const QByteArray &superTypeName); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-29 17:55:56 +01:00
										 |  |  |     void setModifiedFlag(bool b); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | private: // functions
 | 
					
						
							|  |  |  |     ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     void setPropertyVariant(const PropertyName &name, const QVariant &value); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     void setPropertyBinding(const PropertyName &name, const QString &expression); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-17 18:27:57 +02:00
										 |  |  |     void setHideInEditor(bool b); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     void resetProperty(const PropertyName &name); | 
					
						
							|  |  |  |     void refreshProperty(const PropertyName &name); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void activateState(); | 
					
						
							|  |  |  |     void deactivateState(); | 
					
						
							|  |  |  |     void refreshState(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     bool updateStateVariant(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &value); | 
					
						
							|  |  |  |     bool updateStateBinding(const ServerNodeInstance &target, const PropertyName &propertyName, const QString &expression); | 
					
						
							|  |  |  |     bool resetStateProperty(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &resetValue); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     static ServerNodeInstance create(NodeInstanceServer *nodeInstanceServer, const InstanceContainer &instanceContainer, ComponentWrap componentWrap); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setDeleteHeldInstance(bool deleteInstance); | 
					
						
							| 
									
										
										
										
											2013-03-05 12:19:19 +01:00
										 |  |  |     void reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setId(const QString &id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static QSharedPointer<Internal::ObjectNodeInstance> createInstance(QObject *objectToBeWrapped); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void paintUpdate(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setNodeSource(const QString &source); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-18 18:22:15 +02:00
										 |  |  |     bool holdsGraphical() const; | 
					
						
							| 
									
										
										
										
											2013-04-15 13:28:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void updateDirtyNodeRecursive(); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QObject *internalObject() const; // should be not used outside of the nodeinstances!!!!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: // variables
 | 
					
						
							|  |  |  |     QSharedPointer<Internal::ObjectNodeInstance> m_nodeInstance; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uint qHash(const ServerNodeInstance &instance); | 
					
						
							| 
									
										
										
										
											2013-07-04 17:06:31 +02:00
										 |  |  | bool operator ==(const ServerNodeInstance &first, const ServerNodeInstance &second); | 
					
						
							|  |  |  | bool operator <(const ServerNodeInstance &first, const ServerNodeInstance &second); | 
					
						
							|  |  |  | QDebug operator <<(QDebug debug, const ServerNodeInstance &instance); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Q_DECLARE_METATYPE(QmlDesigner::ServerNodeInstance) |