| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:59:14 +01:00
										 |  |  | ** Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02: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.
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +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.
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-18 07:55:01 +01:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QtGlobal>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | #include "objectnodeinstance.h"
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | #include <QQuickItem>
 | 
					
						
							| 
									
										
										
										
											2015-07-14 12:06:07 +02:00
										 |  |  | #include <designersupportdelegate.h>
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace QmlDesigner { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | class QuickItemNodeInstance : public ObjectNodeInstance | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     typedef QSharedPointer<QuickItemNodeInstance> Pointer; | 
					
						
							|  |  |  |     typedef QWeakPointer<QuickItemNodeInstance> WeakPointer; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     ~QuickItemNodeInstance(); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     static Pointer create(QObject *objectToBeWrapped); | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  |     static void createEffectItem(bool createEffectItem); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance) override; | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QQuickItem *contentItem() const override; | 
					
						
							|  |  |  |     bool hasContent() const override; | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QRectF contentItemBoundingBox() const override; | 
					
						
							|  |  |  |     QRectF boundingRect() const override; | 
					
						
							|  |  |  |     QTransform contentTransform() const override; | 
					
						
							|  |  |  |     QTransform sceneTransform() const override; | 
					
						
							|  |  |  |     double opacity() const override; | 
					
						
							|  |  |  |     double rotation() const override; | 
					
						
							|  |  |  |     double scale() const override; | 
					
						
							|  |  |  |     QPointF transformOriginPoint() const override; | 
					
						
							|  |  |  |     double zValue() const override; | 
					
						
							|  |  |  |     QPointF position() const override; | 
					
						
							|  |  |  |     QSizeF size() const override; | 
					
						
							|  |  |  |     QTransform transform() const override; | 
					
						
							|  |  |  |     QTransform contentItemTransform() const override; | 
					
						
							|  |  |  |     int penWidth() const override; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QImage renderImage() const override; | 
					
						
							|  |  |  |     QImage renderPreviewImage(const QSize &previewImageSize) const override; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     void updateAllDirtyNodesRecursive() override; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QObject *parent() const override; | 
					
						
							|  |  |  |     QList<ServerNodeInstance> childItems() const override; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) override; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     void setPropertyVariant(const PropertyName &name, const QVariant &value) override; | 
					
						
							|  |  |  |     void setPropertyBinding(const PropertyName &name, const QString &expression) override; | 
					
						
							|  |  |  |     QVariant property(const PropertyName &name) const override; | 
					
						
							|  |  |  |     void resetProperty(const PropertyName &name) override; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     bool isAnchoredByChildren() const override; | 
					
						
							|  |  |  |     bool hasAnchor(const PropertyName &name) const override; | 
					
						
							|  |  |  |     QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const override; | 
					
						
							|  |  |  |     bool isAnchoredBySibling() const override; | 
					
						
							|  |  |  |     bool isResizable() const override; | 
					
						
							|  |  |  |     bool isMovable() const override; | 
					
						
							|  |  |  |     bool isQuickItem() const override; | 
					
						
							| 
									
										
										
										
											2013-04-15 13:28:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QList<ServerNodeInstance> stateInstances() const override; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     void doComponentComplete() override; | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 15:34:34 +02:00
										 |  |  |     QList<QQuickItem*> allItemsRecursive() const override; | 
					
						
							| 
									
										
										
										
											2014-04-16 12:33:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  |     explicit QuickItemNodeInstance(QQuickItem*); | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     QQuickItem *quickItem() const; | 
					
						
							| 
									
										
										
										
											2013-04-18 18:22:15 +02:00
										 |  |  |     void setMovable(bool movable); | 
					
						
							|  |  |  |     void setResizable(bool resizable); | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  |     void setHasContent(bool hasContent); | 
					
						
							|  |  |  |     DesignerSupport *designerSupport() const; | 
					
						
							|  |  |  |     Qt5NodeInstanceServer *qt5NodeInstanceServer() const; | 
					
						
							|  |  |  |     void updateDirtyNodesRecursive(QQuickItem *parentItem) const; | 
					
						
							|  |  |  |     void updateAllDirtyNodesRecursive(QQuickItem *parentItem) const; | 
					
						
							|  |  |  |     QRectF boundingRectWithStepChilds(QQuickItem *parentItem) const; | 
					
						
							|  |  |  |     void resetHorizontal(); | 
					
						
							|  |  |  |     void resetVertical(); | 
					
						
							|  |  |  |     QList<ServerNodeInstance> childItemsForChild(QQuickItem *item) const; | 
					
						
							|  |  |  |     void refresh(); | 
					
						
							|  |  |  |     static bool anyItemHasContent(QQuickItem *quickItem); | 
					
						
							|  |  |  |     static bool childItemsHaveContent(QQuickItem *quickItem); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     double x() const; | 
					
						
							|  |  |  |     double y() const; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: //variables
 | 
					
						
							| 
									
										
										
										
											2013-05-28 14:14:07 +02:00
										 |  |  |     QPointer<QQuickItem> m_contentItem; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  |     bool m_isResizable; | 
					
						
							|  |  |  |     bool m_isMovable; | 
					
						
							| 
									
										
										
										
											2014-04-16 17:12:16 +02:00
										 |  |  |     bool m_hasHeight; | 
					
						
							|  |  |  |     bool m_hasWidth; | 
					
						
							|  |  |  |     bool m_hasContent; | 
					
						
							|  |  |  |     double m_x; | 
					
						
							|  |  |  |     double m_y; | 
					
						
							|  |  |  |     double m_width; | 
					
						
							|  |  |  |     double m_height; | 
					
						
							|  |  |  |     static bool s_createEffectItem; | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace QmlDesigner
 |