| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:59:14 +01:00
										 |  |  | ** Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** 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 | 
					
						
							| 
									
										
										
										
											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.
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +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.
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "qmlprivategate.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "metaobject.h"
 | 
					
						
							|  |  |  | #include "designercustomobjectdata.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <objectnodeinstance.h>
 | 
					
						
							|  |  |  | #include <nodeinstanceserver.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QQuickItem>
 | 
					
						
							|  |  |  | #include <QQmlComponent>
 | 
					
						
							|  |  |  | #include <QFileInfo>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-13 12:17:50 +01:00
										 |  |  | #include <private/qabstractfileengine_p.h>
 | 
					
						
							|  |  |  | #include <private/qfsfileengine_p.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | #include <private/qquickdesignersupport_p.h>
 | 
					
						
							|  |  |  | #include <private/qquickdesignersupportmetainfo_p.h>
 | 
					
						
							|  |  |  | #include <private/qquickdesignersupportitems_p.h>
 | 
					
						
							|  |  |  | #include <private/qquickdesignersupportproperties_p.h>
 | 
					
						
							|  |  |  | #include <private/qquickdesignersupportpropertychanges_p.h>
 | 
					
						
							|  |  |  | #include <private/qquickdesignersupportstates_p.h>
 | 
					
						
							| 
									
										
										
										
											2018-10-18 15:45:04 +02:00
										 |  |  | #include <private/qqmldata_p.h>
 | 
					
						
							|  |  |  | #include <private/qqmlcomponentattached_p.h>
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace QmlDesigner { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace QmlPrivateGate { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PropertyNameList allPropertyNames(QObject *object, | 
					
						
							|  |  |  |                                   const PropertyName &baseName, | 
					
						
							|  |  |  |                                   QObjectList *inspectedObjects) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::allPropertyNames(object, baseName, inspectedObjects); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PropertyNameList propertyNameListForWritableProperties(QObject *object, | 
					
						
							|  |  |  |                                                        const PropertyName &baseName, | 
					
						
							|  |  |  |                                                        QObjectList *inspectedObjects) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object, baseName, inspectedObjects); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void tweakObjects(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::tweakObjects(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void createNewDynamicProperty(QObject *object,  QQmlEngine *engine, const QString &name) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::createNewDynamicProperty(object, engine, name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::registerNodeInstanceMetaObject(object, engine); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportItems::createPrimitive(typeName, majorNumber, minorNumber, context); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-25 13:17:50 +02:00
										 |  |  | static QString qmlDesignerRCPath() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     static const QString qmlDesignerRcPathsString = QString::fromLocal8Bit( | 
					
						
							|  |  |  |         qgetenv("QMLDESIGNER_RC_PATHS")); | 
					
						
							|  |  |  |     return qmlDesignerRcPathsString; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | QVariant fixResourcePaths(const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (value.type() == QVariant::Url) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         const QUrl url = value.toUrl(); | 
					
						
							|  |  |  |         if (url.scheme() == QLatin1String("qrc")) { | 
					
						
							|  |  |  |             const QString path = QLatin1String("qrc:") +  url.path(); | 
					
						
							| 
									
										
										
										
											2017-04-25 13:17:50 +02:00
										 |  |  |             if (!qmlDesignerRCPath().isEmpty()) { | 
					
						
							|  |  |  |                 const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';')); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                 foreach (const QString &qrcPath, searchPaths) { | 
					
						
							|  |  |  |                     const QStringList qrcDefintion = qrcPath.split(QLatin1Char('=')); | 
					
						
							|  |  |  |                     if (qrcDefintion.count() == 2) { | 
					
						
							|  |  |  |                         QString fixedPath = path; | 
					
						
							|  |  |  |                         fixedPath.replace(QLatin1String("qrc:") + qrcDefintion.first(), qrcDefintion.last() + QLatin1Char('/')); | 
					
						
							| 
									
										
										
										
											2017-04-13 16:26:38 +02:00
										 |  |  |                         if (QFileInfo::exists(fixedPath)) { | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                             fixedPath.replace(QLatin1String("//"), QLatin1String("/")); | 
					
						
							|  |  |  |                             fixedPath.replace(QLatin1Char('\\'), QLatin1Char('/')); | 
					
						
							| 
									
										
										
										
											2016-06-21 13:34:32 +02:00
										 |  |  |                             return QUrl::fromLocalFile(fixedPath); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (value.type() == QVariant::String) { | 
					
						
							|  |  |  |         const QString str = value.toString(); | 
					
						
							|  |  |  |         if (str.contains(QLatin1String("qrc:"))) { | 
					
						
							| 
									
										
										
										
											2017-04-25 13:17:50 +02:00
										 |  |  |             if (!qmlDesignerRCPath().isEmpty()) { | 
					
						
							|  |  |  |                 const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';')); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                 foreach (const QString &qrcPath, searchPaths) { | 
					
						
							|  |  |  |                     const QStringList qrcDefintion = qrcPath.split(QLatin1Char('=')); | 
					
						
							|  |  |  |                     if (qrcDefintion.count() == 2) { | 
					
						
							|  |  |  |                         QString fixedPath = str; | 
					
						
							|  |  |  |                         fixedPath.replace(QLatin1String("qrc:") + qrcDefintion.first(), qrcDefintion.last() + QLatin1Char('/')); | 
					
						
							| 
									
										
										
										
											2017-04-13 16:26:38 +02:00
										 |  |  |                         if (QFileInfo::exists(fixedPath)) { | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                             fixedPath.replace(QLatin1String("//"), QLatin1String("/")); | 
					
						
							|  |  |  |                             fixedPath.replace(QLatin1Char('\\'), QLatin1Char('/')); | 
					
						
							| 
									
										
										
										
											2016-06-29 12:19:48 +02:00
										 |  |  |                             return QUrl::fromLocalFile(fixedPath); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QObject *createComponent(const QUrl &componentUrl, QQmlContext *context) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportItems::createComponent(componentUrl, context); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool hasFullImplementedListInterface(const QQmlListReference &list) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void registerCustomData(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::registerCustomData(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QVariant getResetValue(QObject *object, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-29 10:46:11 +02:00
										 |  |  |     if (propertyName == "Layout.rowSpan") | 
					
						
							|  |  |  |         return 1; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.columnSpan") | 
					
						
							|  |  |  |         return 1; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillHeight") | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillWidth") | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         return QQuickDesignerSupportProperties::getResetValue(object, propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void setProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-03-18 10:19:09 +01:00
										 |  |  |     QQmlProperty property(object, QString::fromUtf8(propertyName), context); | 
					
						
							| 
									
										
										
										
											2015-09-29 10:46:11 +02:00
										 |  |  |     property.write(value); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void doResetProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-29 10:46:11 +02:00
										 |  |  |     if (propertyName == "Layout.rowSpan") | 
					
						
							|  |  |  |         setProperty(object, context, propertyName, getResetValue(object, propertyName)); | 
					
						
							|  |  |  |     else if (propertyName == "Layout.columnSpan") | 
					
						
							|  |  |  |         setProperty(object, context, propertyName, getResetValue(object, propertyName)); | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillHeight") | 
					
						
							|  |  |  |         setProperty(object, context, propertyName, getResetValue(object, propertyName)); | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillWidth") | 
					
						
							|  |  |  |         setProperty(object, context, propertyName, getResetValue(object, propertyName)); | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         QQuickDesignerSupportProperties::doResetProperty(object, context, propertyName); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool hasValidResetBinding(QObject *object, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-29 10:46:11 +02:00
										 |  |  |     if (propertyName == "Layout.rowSpan") | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.columnSpan") | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillHeight") | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     else if (propertyName == "Layout.fillWidth") | 
					
						
							|  |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |     return QQuickDesignerSupportProperties::hasValidResetBinding(object, propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool hasBindingForProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName, bool *hasChanged) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::hasBindingForProperty(object, context, propertyName, hasChanged); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void setPropertyBinding(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QString &expression) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::setPropertyBinding(object, context, propertyName, expression); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-18 15:45:04 +02:00
										 |  |  | void emitComponentComplete(QObject *item) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (!item) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QQmlData *data = QQmlData::get(item); | 
					
						
							|  |  |  |     if (data && data->context) { | 
					
						
							|  |  |  |         QQmlComponentAttached *componentAttached = data->context->componentAttached; | 
					
						
							|  |  |  |         while (componentAttached) { | 
					
						
							|  |  |  |             if (componentAttached->parent()) | 
					
						
							|  |  |  |                 if (componentAttached->parent() == item) | 
					
						
							|  |  |  |                     emit componentAttached->completed(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             componentAttached = componentAttached->next; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (object) { | 
					
						
							|  |  |  |         QQuickItem *item = qobject_cast<QQuickItem*>(object); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (item && DesignerSupport::isComponentComplete(item)) | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-18 15:45:04 +02:00
										 |  |  |         if (!nodeInstanceServer->hasInstanceForObject(item)) | 
					
						
							|  |  |  |             emitComponentComplete(object); | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  |         QList<QObject*> childList = object->children(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (item) { | 
					
						
							|  |  |  |             foreach (QQuickItem *childItem, item->childItems()) { | 
					
						
							|  |  |  |                 if (!childList.contains(childItem)) | 
					
						
							|  |  |  |                     childList.append(childItem); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         foreach (QObject *child, childList) { | 
					
						
							|  |  |  |             if (!nodeInstanceServer->hasInstanceForObject(child)) | 
					
						
							|  |  |  |                 doComponentCompleteRecursive(child, nodeInstanceServer); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (item) { | 
					
						
							|  |  |  |             static_cast<QQmlParserStatus*>(item)->componentComplete(); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             QQmlParserStatus *qmlParserStatus = dynamic_cast< QQmlParserStatus*>(object); | 
					
						
							|  |  |  |             if (qmlParserStatus) | 
					
						
							|  |  |  |                 qmlParserStatus->componentComplete(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::keepBindingFromGettingDeleted(object, context, propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool objectWasDeleted(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportItems::objectWasDeleted(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void disableNativeTextRendering(QQuickItem *item) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::disableNativeTextRendering(item); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void disableTextCursor(QQuickItem *item) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::disableTextCursor(item); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void disableTransition(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::disableTransition(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void disableBehaivour(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::disableBehaivour(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void stopUnifiedTimer() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportItems::stopUnifiedTimer(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool isPropertyQObject(const QMetaProperty &metaProperty) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::isPropertyQObject(metaProperty); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QObject *readQObjectProperty(const QMetaProperty &metaProperty, QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportProperties::readQObjectProperty(metaProperty, object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace States { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool isStateActive(QObject *object, QQmlContext *context) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return QQuickDesignerSupportStates::isStateActive(object, context); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void activateState(QObject *object, QQmlContext *context) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportStates::activateState(object, context); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void deactivateState(QObject *object) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportStates::deactivateState(object); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool changeValueInRevertList(QObject *state, QObject *target, const PropertyName &propertyName, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportStates::changeValueInRevertList(state, target, propertyName, value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool updateStateBinding(QObject *state, QObject *target, const PropertyName &propertyName, const QString &expression) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportStates::updateStateBinding(state, target, propertyName, expression); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool resetStateProperty(QObject *state, QObject *target, const PropertyName &propertyName, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportStates::resetStateProperty(state, target, propertyName, value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } //namespace States
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace PropertyChanges { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void detachFromState(QObject *propertyChanges) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::detachFromState(propertyChanges); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void attachToState(QObject *propertyChanges) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::attachToState(propertyChanges); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QObject *targetObject(QObject *propertyChanges) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::targetObject(propertyChanges); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void removeProperty(QObject *propertyChanges, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportPropertyChanges::removeProperty(propertyChanges, propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QVariant getProperty(QObject *propertyChanges, const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::getProperty(propertyChanges, propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void changeValue(QObject *propertyChanges, const PropertyName &propertyName, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportPropertyChanges::changeValue(propertyChanges, propertyName, value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void changeExpression(QObject *propertyChanges, const PropertyName &propertyName, const QString &expression) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportPropertyChanges::changeExpression(propertyChanges, propertyName, expression); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QObject *stateObject(QObject *propertyChanges) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::stateObject(propertyChanges); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool isNormalProperty(const PropertyName &propertyName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportPropertyChanges::isNormalProperty(propertyName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace PropertyChanges
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool isSubclassOf(QObject *object, const QByteArray &superTypeName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QQuickDesignerSupportMetaInfo::isSubclassOf(object, superTypeName); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void getPropertyCache(QObject *object, QQmlEngine *engine) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportProperties::getPropertyCache(object, engine); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QQuickDesignerSupportMetaInfo::registerNotifyPropertyChangeCallBack(callback); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ComponentCompleteDisabler::ComponentCompleteDisabler() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     DesignerSupport::disableComponentComplete(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ComponentCompleteDisabler::~ComponentCompleteDisabler() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     DesignerSupport::enableComponentComplete(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-13 12:17:50 +01:00
										 |  |  | class QrcEngineHandler : public QAbstractFileEngineHandler | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QAbstractFileEngine *create(const QString &fileName) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QAbstractFileEngine *QrcEngineHandler::create(const QString &fileName) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (fileName.startsWith(":/qt-project.org")) | 
					
						
							|  |  |  |         return nullptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (fileName.startsWith(":/qtquickplugin")) | 
					
						
							|  |  |  |         return nullptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (fileName.startsWith(":/")) { | 
					
						
							|  |  |  |         const QStringList searchPaths = qmlDesignerRCPath().split(';'); | 
					
						
							|  |  |  |         foreach (const QString &qrcPath, searchPaths) { | 
					
						
							|  |  |  |             const QStringList qrcDefintion = qrcPath.split('='); | 
					
						
							|  |  |  |             if (qrcDefintion.count() == 2) { | 
					
						
							|  |  |  |                 QString fixedPath = fileName; | 
					
						
							|  |  |  |                 fixedPath.replace(":" + qrcDefintion.first(), qrcDefintion.last() + '/'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 16:15:40 +01:00
										 |  |  |                 if (fileName == fixedPath) | 
					
						
							|  |  |  |                     return nullptr; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-13 12:17:50 +01:00
										 |  |  |                 if (QFileInfo::exists(fixedPath)) { | 
					
						
							|  |  |  |                     fixedPath.replace("//", "/"); | 
					
						
							|  |  |  |                     fixedPath.replace('\\', '/'); | 
					
						
							|  |  |  |                     return new QFSFileEngine(fixedPath); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static QrcEngineHandler* s_qrcEngineHandler = nullptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class EngineHandlerDeleter | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     EngineHandlerDeleter() | 
					
						
							|  |  |  |     {} | 
					
						
							|  |  |  |     ~EngineHandlerDeleter() | 
					
						
							|  |  |  |     { delete s_qrcEngineHandler; } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-10 16:04:33 +02:00
										 |  |  | void registerFixResourcePathsForObjectCallBack() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-13 12:17:50 +01:00
										 |  |  |     static EngineHandlerDeleter deleter; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!s_qrcEngineHandler) | 
					
						
							|  |  |  |         s_qrcEngineHandler = new QrcEngineHandler(); | 
					
						
							| 
									
										
										
										
											2016-06-10 16:04:33 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 15:27:27 +02:00
										 |  |  | } // namespace QmlPrivateGate
 | 
					
						
							|  |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace QmlDesigner
 |