forked from qt-creator/qt-creator
qmlpuppet: remove qmlprivategate DesignerSupport < Qt 5.6
Task-number: QTCREATORBUG-26600 Change-Id: I629c8cd1f497ed2dd354ff461aa890a77bdc2a01 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -24,9 +24,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "iconrenderer.h"
|
#include "iconrenderer.h"
|
||||||
|
|
||||||
#include "../editor3d/selectionboxgeometry.h"
|
#include "../editor3d/selectionboxgeometry.h"
|
||||||
#include "../editor3d/generalhelper.h"
|
#include "../editor3d/generalhelper.h"
|
||||||
|
|
||||||
|
#include <private/qquickdesignersupport_p.h>
|
||||||
#include <QtQml/qqmlcomponent.h>
|
#include <QtQml/qqmlcomponent.h>
|
||||||
#include <QtQml/qqmlengine.h>
|
#include <QtQml/qqmlengine.h>
|
||||||
#include <QtQml/qqmlproperty.h>
|
#include <QtQml/qqmlproperty.h>
|
||||||
@@ -63,7 +65,7 @@ IconRenderer::IconRenderer(int size, const QString &filePath, const QString &sou
|
|||||||
|
|
||||||
void IconRenderer::setupRender()
|
void IconRenderer::setupRender()
|
||||||
{
|
{
|
||||||
DesignerSupport::activateDesignerMode();
|
QQuickDesignerSupport::activateDesignerMode();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
DesignerSupport::activateDesignerWindowManager();
|
DesignerSupport::activateDesignerWindowManager();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,11 +28,10 @@
|
|||||||
#include <QtCore/qobject.h>
|
#include <QtCore/qobject.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QQuickWindow;
|
class QQuickWindow;
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
|
class QQuickDesignerSupport;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
class QQuickRenderControl;
|
class QQuickRenderControl;
|
||||||
class QRhi;
|
class QRhi;
|
||||||
@@ -66,7 +65,7 @@ private:
|
|||||||
QQuickWindow *m_window = nullptr;
|
QQuickWindow *m_window = nullptr;
|
||||||
QQuickItem *m_contentItem = nullptr;
|
QQuickItem *m_contentItem = nullptr;
|
||||||
QQuickItem *m_containerItem = nullptr;
|
QQuickItem *m_containerItem = nullptr;
|
||||||
DesignerSupport m_designerSupport;
|
std::unique_ptr<QQuickDesignerSupport> m_designerSupport;
|
||||||
bool m_is3D = false;
|
bool m_is3D = false;
|
||||||
int m_focusStep = 0;
|
int m_focusStep = 0;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
|||||||
@@ -80,7 +80,6 @@
|
|||||||
#define NANOTRACE_SCOPE(cat, name)
|
#define NANOTRACE_SCOPE(cat, name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
|
||||||
#include <QAbstractAnimation>
|
#include <QAbstractAnimation>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "qmlpropertychangesnodeinstance.h"
|
#include "qmlpropertychangesnodeinstance.h"
|
||||||
|
|
||||||
#include <qmlprivategate.h>
|
#include <qmlprivategate.h>
|
||||||
#include <designersupportdelegate.h>
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -62,7 +62,7 @@ void setAllNodesDirtyRecursive([[maybe_unused]] QQuickItem *parentItem)
|
|||||||
const QList<QQuickItem *> children = parentItem->childItems();
|
const QList<QQuickItem *> children = parentItem->childItems();
|
||||||
for (QQuickItem *childItem : children)
|
for (QQuickItem *childItem : children)
|
||||||
setAllNodesDirtyRecursive(childItem);
|
setAllNodesDirtyRecursive(childItem);
|
||||||
DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
QQuickDesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
|
|
||||||
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -77,7 +79,7 @@ void Qt5CaptureImageNodeInstanceServer::collectItemChangesAndSendChangeCommands(
|
|||||||
if (QQuickItem *qitem = rooNodeInstance.rootQuickItem())
|
if (QQuickItem *qitem = rooNodeInstance.rootQuickItem())
|
||||||
qitem->setClip(true);
|
qitem->setClip(true);
|
||||||
|
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
QImage image = renderImage(rooNodeInstance, m_minimumSize, m_maximumSize);
|
QImage image = renderImage(rooNodeInstance, m_minimumSize, m_maximumSize);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
|
|
||||||
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -92,7 +94,7 @@ void Qt5CapturePreviewNodeInstanceServer::collectItemChangesAndSendChangeCommand
|
|||||||
if (!inFunction) {
|
if (!inFunction) {
|
||||||
inFunction = true;
|
inFunction = true;
|
||||||
|
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
QVector<CapturedDataCommand::StateData> stateDatas;
|
QVector<CapturedDataCommand::StateData> stateDatas;
|
||||||
stateDatas.push_back(collectStateData(rootNodeInstance(), nodeInstances(), 0));
|
stateDatas.push_back(collectStateData(rootNodeInstance(), nodeInstances(), 0));
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
#include "../editor3d/linegeometry.h"
|
#include "../editor3d/linegeometry.h"
|
||||||
#include "../editor3d/icongizmoimageprovider.h"
|
#include "../editor3d/icongizmoimageprovider.h"
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
#include <private/qquickdesignersupport_p.h>
|
||||||
#include <qmlprivategate.h>
|
#include <qmlprivategate.h>
|
||||||
#include <quickitemnodeinstance.h>
|
#include <quickitemnodeinstance.h>
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ void Qt5InformationNodeInstanceServer::createAuxiliaryQuickView(const QUrl &url,
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
viewData.window = new QQuickView(quickView()->engine(), quickView());
|
viewData.window = new QQuickView(quickView()->engine(), quickView());
|
||||||
viewData.window->setFormat(quickView()->format());
|
viewData.window->setFormat(quickView()->format());
|
||||||
DesignerSupport::createOpenGLContext(static_cast<QQuickView *>(viewData.window.data()));
|
QQuickDesignerSupport::createOpenGLContext(static_cast<QQuickView *>(viewData.window.data()));
|
||||||
#else
|
#else
|
||||||
viewData.renderControl = new QQuickRenderControl;
|
viewData.renderControl = new QQuickRenderControl;
|
||||||
viewData.window = new QQuickWindow(viewData.renderControl);
|
viewData.window = new QQuickWindow(viewData.renderControl);
|
||||||
@@ -211,7 +211,7 @@ void Qt5InformationNodeInstanceServer::createAuxiliaryQuickView(const QUrl &url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
DesignerSupport::setRootItem(static_cast<QQuickView *>(viewData.window.data()), viewData.rootItem);
|
QQuickDesignerSupport::setRootItem(static_cast<QQuickView *>(viewData.window.data()), viewData.rootItem);
|
||||||
#else
|
#else
|
||||||
viewData.window->contentItem()->setSize(viewData.rootItem->size());
|
viewData.window->contentItem()->setSize(viewData.rootItem->size());
|
||||||
viewData.window->setGeometry(0, 0, viewData.rootItem->width(), viewData.rootItem->height());
|
viewData.window->setGeometry(0, 0, viewData.rootItem->width(), viewData.rootItem->height());
|
||||||
@@ -957,7 +957,7 @@ void Qt5InformationNodeInstanceServer::updateNodesRecursive(QQuickItem *item)
|
|||||||
if (item->flags() & QQuickItem::ItemHasContents)
|
if (item->flags() & QQuickItem::ItemHasContents)
|
||||||
item->update();
|
item->update();
|
||||||
} else {
|
} else {
|
||||||
DesignerSupport::updateDirtyNode(item);
|
QQuickDesignerSupport::updateDirtyNode(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1394,18 +1394,18 @@ void Qt5InformationNodeInstanceServer::token(const TokenCommand &command)
|
|||||||
|
|
||||||
bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const
|
bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const
|
||||||
{
|
{
|
||||||
static DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask
|
static QQuickDesignerSupport::DirtyType informationsDirty = QQuickDesignerSupport::DirtyType(QQuickDesignerSupport::TransformUpdateMask
|
||||||
| DesignerSupport::ContentUpdateMask
|
| QQuickDesignerSupport::ContentUpdateMask
|
||||||
| DesignerSupport::Visible
|
| QQuickDesignerSupport::Visible
|
||||||
| DesignerSupport::ZValue
|
| QQuickDesignerSupport::ZValue
|
||||||
| DesignerSupport::OpacityValue);
|
| QQuickDesignerSupport::OpacityValue);
|
||||||
|
|
||||||
if (DesignerSupport::isDirty(item, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, item->childItems()) {
|
foreach (QQuickItem *childItem, item->childItems()) {
|
||||||
if (!hasInstanceForObject(childItem)) {
|
if (!hasInstanceForObject(childItem)) {
|
||||||
if (DesignerSupport::isDirty(childItem, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
else if (isDirtyRecursiveForNonInstanceItems(childItem))
|
else if (isDirtyRecursiveForNonInstanceItems(childItem))
|
||||||
return true;
|
return true;
|
||||||
@@ -1417,7 +1417,7 @@ bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuic
|
|||||||
|
|
||||||
bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForParentInstances(QQuickItem *item) const
|
bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForParentInstances(QQuickItem *item) const
|
||||||
{
|
{
|
||||||
if (DesignerSupport::isDirty(item, DesignerSupport::TransformUpdateMask))
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::TransformUpdateMask))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QQuickItem *parentItem = item->parentItem();
|
QQuickItem *parentItem = item->parentItem();
|
||||||
@@ -1883,7 +1883,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
if (!inFunction) {
|
if (!inFunction) {
|
||||||
inFunction = true;
|
inFunction = true;
|
||||||
|
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
QSet<ServerNodeInstance> informationChangedInstanceSet;
|
QSet<ServerNodeInstance> informationChangedInstanceSet;
|
||||||
QVector<InstancePropertyPair> propertyChangedList;
|
QVector<InstancePropertyPair> propertyChangedList;
|
||||||
@@ -1898,7 +1898,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
else if (isDirtyRecursiveForParentInstances(item))
|
else if (isDirtyRecursiveForParentInstances(item))
|
||||||
informationChangedInstanceSet.insert(instance);
|
informationChangedInstanceSet.insert(instance);
|
||||||
|
|
||||||
if (DesignerSupport::isDirty(item, DesignerSupport::ParentChanged)) {
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::ParentChanged)) {
|
||||||
m_parentChangedSet.insert(instance);
|
m_parentChangedSet.insert(instance);
|
||||||
informationChangedInstanceSet.insert(instance);
|
informationChangedInstanceSet.insert(instance);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,6 @@
|
|||||||
#include "qt5testnodeinstanceserver.h"
|
#include "qt5testnodeinstanceserver.h"
|
||||||
#include "quickitemnodeinstance.h"
|
#include "quickitemnodeinstance.h"
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
#include <private/qquickdesignersupport_p.h>
|
||||||
#include <addimportcontainer.h>
|
#include <addimportcontainer.h>
|
||||||
#include <createscenecommand.h>
|
#include <createscenecommand.h>
|
||||||
#include <reparentinstancescommand.h>
|
#include <reparentinstancescommand.h>
|
||||||
@@ -69,7 +69,7 @@ Qt5NodeInstanceServer::Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeIn
|
|||||||
: NodeInstanceServer(nodeInstanceClient)
|
: NodeInstanceServer(nodeInstanceClient)
|
||||||
{
|
{
|
||||||
if (!ViewConfig::isParticleViewMode())
|
if (!ViewConfig::isParticleViewMode())
|
||||||
DesignerSupport::activateDesignerMode();
|
QQuickDesignerSupport::activateDesignerMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt5NodeInstanceServer::~Qt5NodeInstanceServer()
|
Qt5NodeInstanceServer::~Qt5NodeInstanceServer()
|
||||||
@@ -106,7 +106,7 @@ void Qt5NodeInstanceServer::initializeView()
|
|||||||
QSurfaceFormat::setDefaultFormat(surfaceFormat);
|
QSurfaceFormat::setDefaultFormat(surfaceFormat);
|
||||||
view->setFormat(surfaceFormat);
|
view->setFormat(surfaceFormat);
|
||||||
|
|
||||||
DesignerSupport::createOpenGLContext(view);
|
QQuickDesignerSupport::createOpenGLContext(view);
|
||||||
m_qmlEngine = view->engine();
|
m_qmlEngine = view->engine();
|
||||||
#else
|
#else
|
||||||
m_viewData.renderControl = new QQuickRenderControl;
|
m_viewData.renderControl = new QQuickRenderControl;
|
||||||
@@ -138,7 +138,7 @@ void Qt5NodeInstanceServer::setRootItem(QQuickItem *item)
|
|||||||
{
|
{
|
||||||
m_viewData.rootItem = item;
|
m_viewData.rootItem = item;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
DesignerSupport::setRootItem(quickView(), item);
|
QQuickDesignerSupport::setRootItem(quickView(), item);
|
||||||
#else
|
#else
|
||||||
quickWindow()->setGeometry(0, 0, item->width(), item->height());
|
quickWindow()->setGeometry(0, 0, item->width(), item->height());
|
||||||
// Insert an extra item above the root to adjust root item position to 0,0 to make entire
|
// Insert an extra item above the root to adjust root item position to 0,0 to make entire
|
||||||
@@ -163,13 +163,13 @@ void Qt5NodeInstanceServer::resizeCanvasToRootItem()
|
|||||||
m_viewData.contentItem->setPosition(-m_viewData.rootItem->position());
|
m_viewData.contentItem->setPosition(-m_viewData.rootItem->position());
|
||||||
#endif
|
#endif
|
||||||
quickWindow()->resize(rootNodeInstance().boundingRect().size().toSize());
|
quickWindow()->resize(rootNodeInstance().boundingRect().size().toSize());
|
||||||
DesignerSupport::addDirty(rootNodeInstance().rootQuickItem(), QQuickDesignerSupport::Size);
|
QQuickDesignerSupport::addDirty(rootNodeInstance().rootQuickItem(), QQuickDesignerSupport::Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt5NodeInstanceServer::resetAllItems()
|
void Qt5NodeInstanceServer::resetAllItems()
|
||||||
{
|
{
|
||||||
foreach (QQuickItem *item, allItems())
|
foreach (QQuickItem *item, allItems())
|
||||||
DesignerSupport::resetDirty(item);
|
QQuickDesignerSupport::resetDirty(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command)
|
void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command)
|
||||||
@@ -524,12 +524,12 @@ QImage Qt5NodeInstanceServer::grabItem([[maybe_unused]] QQuickItem *item)
|
|||||||
|
|
||||||
void Qt5NodeInstanceServer::refreshBindings()
|
void Qt5NodeInstanceServer::refreshBindings()
|
||||||
{
|
{
|
||||||
DesignerSupport::refreshExpressions(context());
|
QQuickDesignerSupport::refreshExpressions(context());
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignerSupport *Qt5NodeInstanceServer::designerSupport()
|
QQuickDesignerSupport *Qt5NodeInstanceServer::designerSupport()
|
||||||
{
|
{
|
||||||
return &m_designerSupport;
|
return m_designerSupport.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt5NodeInstanceServer::createScene(const CreateSceneCommand &command)
|
void Qt5NodeInstanceServer::createScene(const CreateSceneCommand &command)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@
|
|||||||
#include <QtQuick/qquickwindow.h>
|
#include <QtQuick/qquickwindow.h>
|
||||||
|
|
||||||
#include "nodeinstanceserver.h"
|
#include "nodeinstanceserver.h"
|
||||||
#include <designersupportdelegate.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QQmlEngine;
|
class QQmlEngine;
|
||||||
|
class QQuickDesignerSupport;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
class QQuickRenderControl;
|
class QQuickRenderControl;
|
||||||
class QRhi;
|
class QRhi;
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
QQmlEngine *engine() const override;
|
QQmlEngine *engine() const override;
|
||||||
void refreshBindings() override;
|
void refreshBindings() override;
|
||||||
|
|
||||||
DesignerSupport *designerSupport();
|
QQuickDesignerSupport *designerSupport();
|
||||||
|
|
||||||
void createScene(const CreateSceneCommand &command) override;
|
void createScene(const CreateSceneCommand &command) override;
|
||||||
void clearScene(const ClearSceneCommand &command) override;
|
void clearScene(const ClearSceneCommand &command) override;
|
||||||
@@ -102,7 +102,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
RenderViewData m_viewData;
|
RenderViewData m_viewData;
|
||||||
DesignerSupport m_designerSupport;
|
std::unique_ptr<QQuickDesignerSupport> m_designerSupport;
|
||||||
QQmlEngine *m_qmlEngine = nullptr;
|
QQmlEngine *m_qmlEngine = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <designersupportdelegate.h>
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ void Qt5PreviewNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
if (!inFunction && nodeInstanceClient()->bytesToWrite() < 10000) {
|
if (!inFunction && nodeInstanceClient()->bytesToWrite() < 10000) {
|
||||||
inFunction = true;
|
inFunction = true;
|
||||||
|
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
QVector<ImageContainer> imageContainerVector;
|
QVector<ImageContainer> imageContainerVector;
|
||||||
imageContainerVector.append(ImageContainer(0, renderPreviewImage(), -1));
|
imageContainerVector.append(ImageContainer(0, renderPreviewImage(), -1));
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
#include "dummycontextobject.h"
|
#include "dummycontextobject.h"
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -74,33 +74,33 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
if (!inFunction) {
|
if (!inFunction) {
|
||||||
inFunction = true;
|
inFunction = true;
|
||||||
|
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
|
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
|
||||||
bool windowDirty = false;
|
bool windowDirty = false;
|
||||||
foreach (QQuickItem *item, allItems()) {
|
foreach (QQuickItem *item, allItems()) {
|
||||||
if (item) {
|
if (item) {
|
||||||
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
|
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
|
||||||
if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) {
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::AllMask)) {
|
||||||
windowDirty = true;
|
windowDirty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hasInstanceForObject(item)) {
|
if (hasInstanceForObject(item)) {
|
||||||
if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask))
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::ContentUpdateMask))
|
||||||
m_dirtyInstanceSet.insert(instanceForObject(item));
|
m_dirtyInstanceSet.insert(instanceForObject(item));
|
||||||
if (QQuickItem *effectParent = parentEffectItem(item)) {
|
if (QQuickItem *effectParent = parentEffectItem(item)) {
|
||||||
if ((DesignerSupport::isDirty(
|
if ((QQuickDesignerSupport::isDirty(
|
||||||
item,
|
item,
|
||||||
DesignerSupport::DirtyType(
|
QQuickDesignerSupport::DirtyType(
|
||||||
DesignerSupport::TransformUpdateMask
|
QQuickDesignerSupport::TransformUpdateMask
|
||||||
| DesignerSupport::Visible
|
| QQuickDesignerSupport::Visible
|
||||||
| DesignerSupport::ContentUpdateMask)))
|
| QQuickDesignerSupport::ContentUpdateMask)))
|
||||||
&& hasInstanceForObject(effectParent)) {
|
&& hasInstanceForObject(effectParent)) {
|
||||||
m_dirtyInstanceSet.insert(instanceForObject(effectParent));
|
m_dirtyInstanceSet.insert(instanceForObject(effectParent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) {
|
} else if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::AllMask)) {
|
||||||
ServerNodeInstance ancestorInstance = findNodeInstanceForItem(
|
ServerNodeInstance ancestorInstance = findNodeInstanceForItem(
|
||||||
item->parentItem());
|
item->parentItem());
|
||||||
if (ancestorInstance.isValid())
|
if (ancestorInstance.isValid())
|
||||||
|
|||||||
@@ -25,9 +25,6 @@
|
|||||||
|
|
||||||
#include "qt5testnodeinstanceserver.h"
|
#include "qt5testnodeinstanceserver.h"
|
||||||
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QQuickView>
|
|
||||||
|
|
||||||
#include "servernodeinstance.h"
|
#include "servernodeinstance.h"
|
||||||
#include "childrenchangeeventfilter.h"
|
#include "childrenchangeeventfilter.h"
|
||||||
#include "propertyabstractcontainer.h"
|
#include "propertyabstractcontainer.h"
|
||||||
@@ -60,7 +57,10 @@
|
|||||||
|
|
||||||
#include "dummycontextobject.h"
|
#include "dummycontextobject.h"
|
||||||
|
|
||||||
#include <designersupportdelegate.h>
|
#include <QQuickItem>
|
||||||
|
#include <QQuickView>
|
||||||
|
|
||||||
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ void Qt5TestNodeInstanceServer::removeSharedMemory(const RemoveSharedMemoryComma
|
|||||||
|
|
||||||
void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||||
{
|
{
|
||||||
DesignerSupport::polishItems(quickWindow());
|
QQuickDesignerSupport::polishItems(quickWindow());
|
||||||
|
|
||||||
QSet<ServerNodeInstance> informationChangedInstanceSet;
|
QSet<ServerNodeInstance> informationChangedInstanceSet;
|
||||||
QVector<InstancePropertyPair> propertyChangedList;
|
QVector<InstancePropertyPair> propertyChangedList;
|
||||||
@@ -272,7 +272,7 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
|||||||
informationChangedInstanceSet.insert(instance);
|
informationChangedInstanceSet.insert(instance);
|
||||||
|
|
||||||
|
|
||||||
if (DesignerSupport::isDirty(item, DesignerSupport::ParentChanged)) {
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::ParentChanged)) {
|
||||||
parentChangedSet.insert(instance);
|
parentChangedSet.insert(instance);
|
||||||
informationChangedInstanceSet.insert(instance);
|
informationChangedInstanceSet.insert(instance);
|
||||||
}
|
}
|
||||||
@@ -342,18 +342,18 @@ void Qt5TestNodeInstanceServer::sendChildrenChangedCommand(const QList<ServerNod
|
|||||||
|
|
||||||
bool Qt5TestNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const
|
bool Qt5TestNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const
|
||||||
{
|
{
|
||||||
static DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask
|
static QQuickDesignerSupport::DirtyType informationsDirty = QQuickDesignerSupport::DirtyType(QQuickDesignerSupport::TransformUpdateMask
|
||||||
| DesignerSupport::ContentUpdateMask
|
| QQuickDesignerSupport::ContentUpdateMask
|
||||||
| DesignerSupport::Visible
|
| QQuickDesignerSupport::Visible
|
||||||
| DesignerSupport::ZValue
|
| QQuickDesignerSupport::ZValue
|
||||||
| DesignerSupport::OpacityValue);
|
| QQuickDesignerSupport::OpacityValue);
|
||||||
|
|
||||||
if (DesignerSupport::isDirty(item, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, item->childItems()) {
|
foreach (QQuickItem *childItem, item->childItems()) {
|
||||||
if (!hasInstanceForObject(childItem)) {
|
if (!hasInstanceForObject(childItem)) {
|
||||||
if (DesignerSupport::isDirty(childItem, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
else if (isDirtyRecursiveForNonInstanceItems(childItem))
|
else if (isDirtyRecursiveForNonInstanceItems(childItem))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <QtQuick/private/qquickitem_p.h>
|
#include <QtQuick/private/qquickitem_p.h>
|
||||||
#include <QtQuick/private/qquickshadereffectsource_p.h>
|
#include <QtQuick/private/qquickshadereffectsource_p.h>
|
||||||
|
|
||||||
|
#include <private/qquickdesignersupport_p.h>
|
||||||
|
|
||||||
#include <QQmlProperty>
|
#include <QQmlProperty>
|
||||||
#include <QQmlExpression>
|
#include <QQmlExpression>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
@@ -86,7 +88,7 @@ static QTransform transformForItem(QQuickItem *item, NodeInstanceServer *nodeIns
|
|||||||
if (isContentItem(item, nodeInstanceServer))
|
if (isContentItem(item, nodeInstanceServer))
|
||||||
return QTransform();
|
return QTransform();
|
||||||
|
|
||||||
QTransform toParentTransform = DesignerSupport::parentTransform(item);
|
QTransform toParentTransform = QQuickDesignerSupport::parentTransform(item);
|
||||||
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
||||||
|
|
||||||
return transformForItem(item->parentItem(), nodeInstanceServer) * toParentTransform;
|
return transformForItem(item->parentItem(), nodeInstanceServer) * toParentTransform;
|
||||||
@@ -97,7 +99,7 @@ static QTransform transformForItem(QQuickItem *item, NodeInstanceServer *nodeIns
|
|||||||
|
|
||||||
QTransform QuickItemNodeInstance::transform() const
|
QTransform QuickItemNodeInstance::transform() const
|
||||||
{ if (quickItem()->parentItem())
|
{ if (quickItem()->parentItem())
|
||||||
return DesignerSupport::parentTransform(quickItem());
|
return QQuickDesignerSupport::parentTransform(quickItem());
|
||||||
|
|
||||||
return QTransform();
|
return QTransform();
|
||||||
}
|
}
|
||||||
@@ -262,7 +264,7 @@ QStringList QuickItemNodeInstance::allStates() const
|
|||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
|
|
||||||
QList<QObject*> stateList = DesignerSupport::statesForItem(quickItem());
|
QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem());
|
||||||
for (QObject *state : stateList) {
|
for (QObject *state : stateList) {
|
||||||
QQmlProperty property(state, "name");
|
QQmlProperty property(state, "name");
|
||||||
if (property.isValid())
|
if (property.isValid())
|
||||||
@@ -277,7 +279,7 @@ void QuickItemNodeInstance::updateDirtyNode([[maybe_unused]] QQuickItem *item)
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
if (s_unifiedRenderPath)
|
if (s_unifiedRenderPath)
|
||||||
return;
|
return;
|
||||||
DesignerSupport::updateDirtyNode(item);
|
QQuickDesignerSupport::updateDirtyNode(item);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +321,7 @@ void QuickItemNodeInstance::setHiddenInEditor(bool hide)
|
|||||||
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
|
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
|
||||||
{
|
{
|
||||||
if (contentItem()) {
|
if (contentItem()) {
|
||||||
QTransform contentItemTransform = DesignerSupport::parentTransform(contentItem());
|
QTransform contentItemTransform = QQuickDesignerSupport::parentTransform(contentItem());
|
||||||
return contentItemTransform.mapRect(contentItem()->boundingRect());
|
return contentItemTransform.mapRect(contentItem()->boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +369,7 @@ static QTransform contentTransformForItem(QQuickItem *item, NodeInstanceServer *
|
|||||||
{
|
{
|
||||||
QTransform contentTransform;
|
QTransform contentTransform;
|
||||||
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
||||||
contentTransform = DesignerSupport::parentTransform(item->parentItem());
|
contentTransform = QQuickDesignerSupport::parentTransform(item->parentItem());
|
||||||
return contentTransformForItem(item->parentItem(), nodeInstanceServer) * contentTransform;
|
return contentTransformForItem(item->parentItem(), nodeInstanceServer) * contentTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +383,7 @@ QTransform QuickItemNodeInstance::contentTransform() const
|
|||||||
|
|
||||||
QTransform QuickItemNodeInstance::sceneTransform() const
|
QTransform QuickItemNodeInstance::sceneTransform() const
|
||||||
{
|
{
|
||||||
return DesignerSupport::windowTransform(quickItem());
|
return QQuickDesignerSupport::windowTransform(quickItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
double QuickItemNodeInstance::opacity() const
|
double QuickItemNodeInstance::opacity() const
|
||||||
@@ -418,7 +420,7 @@ QSizeF QuickItemNodeInstance::size() const
|
|||||||
{
|
{
|
||||||
double width;
|
double width;
|
||||||
|
|
||||||
if (DesignerSupport::isValidHeight(quickItem())) { // isValidHeight is QQuickItemPrivate::get(item)->widthValid
|
if (QQuickDesignerSupport::isValidHeight(quickItem())) { // isValidHeight is QQuickItemPrivate::get(item)->widthValid
|
||||||
width = quickItem()->width();
|
width = quickItem()->width();
|
||||||
} else {
|
} else {
|
||||||
width = quickItem()->implicitWidth();
|
width = quickItem()->implicitWidth();
|
||||||
@@ -426,7 +428,7 @@ QSizeF QuickItemNodeInstance::size() const
|
|||||||
|
|
||||||
double height;
|
double height;
|
||||||
|
|
||||||
if (DesignerSupport::isValidWidth(quickItem())) { // isValidWidth is QQuickItemPrivate::get(item)->heightValid
|
if (QQuickDesignerSupport::isValidWidth(quickItem())) { // isValidWidth is QQuickItemPrivate::get(item)->heightValid
|
||||||
height = quickItem()->height();
|
height = quickItem()->height();
|
||||||
} else {
|
} else {
|
||||||
height = quickItem()->implicitHeight();
|
height = quickItem()->implicitHeight();
|
||||||
@@ -438,7 +440,7 @@ QSizeF QuickItemNodeInstance::size() const
|
|||||||
|
|
||||||
static QTransform contentItemTransformForItem(QQuickItem *item, NodeInstanceServer *nodeInstanceServer)
|
static QTransform contentItemTransformForItem(QQuickItem *item, NodeInstanceServer *nodeInstanceServer)
|
||||||
{
|
{
|
||||||
QTransform toParentTransform = DesignerSupport::parentTransform(item);
|
QTransform toParentTransform = QQuickDesignerSupport::parentTransform(item);
|
||||||
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
|
||||||
|
|
||||||
return transformForItem(item->parentItem(), nodeInstanceServer) * toParentTransform;
|
return transformForItem(item->parentItem(), nodeInstanceServer) * toParentTransform;
|
||||||
@@ -457,7 +459,7 @@ QTransform QuickItemNodeInstance::contentItemTransform() const
|
|||||||
|
|
||||||
int QuickItemNodeInstance::penWidth() const
|
int QuickItemNodeInstance::penWidth() const
|
||||||
{
|
{
|
||||||
return DesignerSupport::borderWidth(quickItem());
|
return QQuickDesignerSupport::borderWidth(quickItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
double QuickItemNodeInstance::x() const
|
double QuickItemNodeInstance::x() const
|
||||||
@@ -576,7 +578,7 @@ bool QuickItemNodeInstance::isRenderable() const
|
|||||||
QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const
|
QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const
|
||||||
{
|
{
|
||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
QList<QObject*> stateList = DesignerSupport::statesForItem(quickItem());
|
QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem());
|
||||||
foreach (QObject *state, stateList)
|
foreach (QObject *state, stateList)
|
||||||
{
|
{
|
||||||
if (state && nodeInstanceServer()->hasInstanceForObject(state))
|
if (state && nodeInstanceServer()->hasInstanceForObject(state))
|
||||||
@@ -604,7 +606,7 @@ void QuickItemNodeInstance::setHasContent(bool hasContent)
|
|||||||
m_hasContent = hasContent;
|
m_hasContent = hasContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignerSupport *QuickItemNodeInstance::designerSupport() const
|
QQuickDesignerSupport *QuickItemNodeInstance::designerSupport() const
|
||||||
{
|
{
|
||||||
return qt5NodeInstanceServer()->designerSupport();
|
return qt5NodeInstanceServer()->designerSupport();
|
||||||
}
|
}
|
||||||
@@ -623,7 +625,7 @@ void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) co
|
|||||||
|
|
||||||
QmlPrivateGate::disableNativeTextRendering(parentItem);
|
QmlPrivateGate::disableNativeTextRendering(parentItem);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
DesignerSupport::updateDirtyNode(parentItem);
|
QQuickDesignerSupport::updateDirtyNode(parentItem);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,7 +644,7 @@ void QuickItemNodeInstance::setAllNodesDirtyRecursive([[maybe_unused]] QQuickIte
|
|||||||
const QList<QQuickItem *> children = parentItem->childItems();
|
const QList<QQuickItem *> children = parentItem->childItems();
|
||||||
for (QQuickItem *childItem : children)
|
for (QQuickItem *childItem : children)
|
||||||
setAllNodesDirtyRecursive(childItem);
|
setAllNodesDirtyRecursive(childItem);
|
||||||
DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
QQuickDesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,7 +932,7 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name)
|
|||||||
if (name == "layer.enabled" || name == "layer.effect")
|
if (name == "layer.enabled" || name == "layer.effect")
|
||||||
setAllNodesDirtyRecursive(quickItem());
|
setAllNodesDirtyRecursive(quickItem());
|
||||||
|
|
||||||
DesignerSupport::resetAnchor(quickItem(), QString::fromUtf8(name));
|
QQuickDesignerSupport::resetAnchor(quickItem(), QString::fromUtf8(name));
|
||||||
|
|
||||||
if (name == "anchors.fill") {
|
if (name == "anchors.fill") {
|
||||||
resetHorizontal();
|
resetHorizontal();
|
||||||
@@ -964,12 +966,12 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name)
|
|||||||
|
|
||||||
bool QuickItemNodeInstance::isAnchoredByChildren() const
|
bool QuickItemNodeInstance::isAnchoredByChildren() const
|
||||||
{
|
{
|
||||||
return DesignerSupport::areChildrenAnchoredTo(quickItem(), quickItem());
|
return QQuickDesignerSupport::areChildrenAnchoredTo(quickItem(), quickItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuickItemNodeInstance::hasAnchor(const PropertyName &name) const
|
bool QuickItemNodeInstance::hasAnchor(const PropertyName &name) const
|
||||||
{
|
{
|
||||||
return DesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name));
|
return QQuickDesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isValidAnchorName(const PropertyName &name)
|
static bool isValidAnchorName(const PropertyName &name)
|
||||||
@@ -989,11 +991,11 @@ static bool isValidAnchorName(const PropertyName &name)
|
|||||||
|
|
||||||
QPair<PropertyName, ServerNodeInstance> QuickItemNodeInstance::anchor(const PropertyName &name) const
|
QPair<PropertyName, ServerNodeInstance> QuickItemNodeInstance::anchor(const PropertyName &name) const
|
||||||
{
|
{
|
||||||
if (!isValidAnchorName(name) || !DesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name)))
|
if (!isValidAnchorName(name) || !QQuickDesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name)))
|
||||||
return ObjectNodeInstance::anchor(name);
|
return ObjectNodeInstance::anchor(name);
|
||||||
|
|
||||||
QPair<QString, QObject*> nameObjectPair =
|
QPair<QString, QObject*> nameObjectPair =
|
||||||
DesignerSupport::anchorLineTarget(quickItem(), QString::fromUtf8(name), context());
|
QQuickDesignerSupport::anchorLineTarget(quickItem(), QString::fromUtf8(name), context());
|
||||||
|
|
||||||
QObject *targetObject = nameObjectPair.second;
|
QObject *targetObject = nameObjectPair.second;
|
||||||
PropertyName targetName = nameObjectPair.first.toUtf8();
|
PropertyName targetName = nameObjectPair.first.toUtf8();
|
||||||
@@ -1013,7 +1015,7 @@ bool QuickItemNodeInstance::isAnchoredBySibling() const
|
|||||||
if (quickItem()->parentItem()) {
|
if (quickItem()->parentItem()) {
|
||||||
foreach (QQuickItem *siblingItem, quickItem()->parentItem()->childItems()) { // search in siblings for a anchor to this item
|
foreach (QQuickItem *siblingItem, quickItem()->parentItem()->childItems()) { // search in siblings for a anchor to this item
|
||||||
if (siblingItem) {
|
if (siblingItem) {
|
||||||
if (DesignerSupport::isAnchoredTo(siblingItem, quickItem()))
|
if (QQuickDesignerSupport::isAnchoredTo(siblingItem, quickItem()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1049,13 +1051,13 @@ void QuickItemNodeInstance::markRepeaterParentDirty() const
|
|||||||
// If a Repeater instance was changed in any way, the parent must be marked dirty to rerender it
|
// If a Repeater instance was changed in any way, the parent must be marked dirty to rerender it
|
||||||
const QByteArray type("QQuickRepeater");
|
const QByteArray type("QQuickRepeater");
|
||||||
if (ServerNodeInstance::isSubclassOf(item, type))
|
if (ServerNodeInstance::isSubclassOf(item, type))
|
||||||
DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
QQuickDesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
|
||||||
|
|
||||||
// Repeater's parent must also be dirtied when a child of a repeater was changed
|
// Repeater's parent must also be dirtied when a child of a repeater was changed
|
||||||
if (ServerNodeInstance::isSubclassOf(parentItem, type)) {
|
if (ServerNodeInstance::isSubclassOf(parentItem, type)) {
|
||||||
QQuickItem *parentsParent = parentItem->parentItem();
|
QQuickItem *parentsParent = parentItem->parentItem();
|
||||||
if (parentsParent)
|
if (parentsParent)
|
||||||
DesignerSupport::addDirty(parentsParent, QQuickDesignerSupport::Content);
|
QQuickDesignerSupport::addDirty(parentsParent, QQuickDesignerSupport::Content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,10 @@
|
|||||||
#include "objectnodeinstance.h"
|
#include "objectnodeinstance.h"
|
||||||
|
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <designersupportdelegate.h>
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QQuickDesignerSupport;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -115,7 +118,7 @@ protected:
|
|||||||
void setMovable(bool movable);
|
void setMovable(bool movable);
|
||||||
void setResizable(bool resizable);
|
void setResizable(bool resizable);
|
||||||
void setHasContent(bool hasContent);
|
void setHasContent(bool hasContent);
|
||||||
DesignerSupport *designerSupport() const;
|
QQuickDesignerSupport *designerSupport() const;
|
||||||
Qt5NodeInstanceServer *qt5NodeInstanceServer() const;
|
Qt5NodeInstanceServer *qt5NodeInstanceServer() const;
|
||||||
void updateDirtyNodesRecursive(QQuickItem *parentItem) const;
|
void updateDirtyNodesRecursive(QQuickItem *parentItem) const;
|
||||||
void updateAllDirtyNodesRecursive(QQuickItem *parentItem) const;
|
void updateAllDirtyNodesRecursive(QQuickItem *parentItem) const;
|
||||||
|
|||||||
@@ -1,292 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "designercustomobjectdata.h"
|
|
||||||
|
|
||||||
#include <qmlprivategate.h>
|
|
||||||
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QQmlEngine>
|
|
||||||
|
|
||||||
#include <private/qqmlbinding_p.h>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace QmlPrivateGate {
|
|
||||||
|
|
||||||
QHash<QObject *, DesignerCustomObjectData*> m_objectToDataHash;
|
|
||||||
|
|
||||||
DesignerCustomObjectData::DesignerCustomObjectData(QObject *object)
|
|
||||||
: m_object(object)
|
|
||||||
{
|
|
||||||
if (object) {
|
|
||||||
populateResetHashes();
|
|
||||||
m_objectToDataHash.insert(object, this);
|
|
||||||
QObject::connect(object, &QObject::destroyed, [=] {
|
|
||||||
m_objectToDataHash.remove(object);
|
|
||||||
delete this;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::registerData(QObject *object)
|
|
||||||
{
|
|
||||||
new DesignerCustomObjectData(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
DesignerCustomObjectData *DesignerCustomObjectData::get(QObject *object)
|
|
||||||
{
|
|
||||||
return m_objectToDataHash.value(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DesignerCustomObjectData::getResetValue(QObject *object, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
return data->getResetValue(propertyName);
|
|
||||||
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::doResetProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
data->doResetProperty(context, propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesignerCustomObjectData::hasValidResetBinding(QObject *object, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
return data->hasValidResetBinding(propertyName);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesignerCustomObjectData::hasBindingForProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName, bool *hasChanged)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
return data->hasBindingForProperty(context, propertyName, hasChanged);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::setPropertyBinding(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QString &expression)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
data->setPropertyBinding(context, propertyName, expression);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
DesignerCustomObjectData* data = get(object);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
data->keepBindingFromGettingDeleted(context, propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::populateResetHashes()
|
|
||||||
{
|
|
||||||
PropertyNameList propertyNameList = QmlPrivateGate::propertyNameListForWritableProperties(object());
|
|
||||||
|
|
||||||
foreach (const PropertyName &propertyName, propertyNameList) {
|
|
||||||
QQmlProperty property(object(), QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object()));
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
QQmlAbstractBinding::Ptr binding = QQmlAbstractBinding::Ptr(QQmlPropertyPrivate::binding(property));
|
|
||||||
#else
|
|
||||||
QQmlAbstractBinding::Pointer binding = QQmlAbstractBinding::getPointer(QQmlPropertyPrivate::binding(property));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (binding) {
|
|
||||||
m_resetBindingHash.insert(propertyName, binding);
|
|
||||||
} else if (property.isWritable()) {
|
|
||||||
m_resetValueHash.insert(propertyName, property.read());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_resetValueHash.insert("Layout.rowSpan", 1);
|
|
||||||
m_resetValueHash.insert("Layout.columnSpan", 1);
|
|
||||||
m_resetValueHash.insert("Layout.fillHeight", false);
|
|
||||||
m_resetValueHash.insert("Layout.fillWidth", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject *DesignerCustomObjectData::object() const
|
|
||||||
{
|
|
||||||
return m_object;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DesignerCustomObjectData::getResetValue(const PropertyName &propertyName) const
|
|
||||||
{
|
|
||||||
return m_resetValueHash.value(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::doResetProperty(QQmlContext *context, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
|
|
||||||
|
|
||||||
if (!property.isValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QVariant oldValue = property.read();
|
|
||||||
if (oldValue.type() == QVariant::Url) {
|
|
||||||
QUrl url = oldValue.toUrl();
|
|
||||||
QString path = url.toLocalFile();
|
|
||||||
/* ### TODO
|
|
||||||
if (QFileInfo(path).exists() && nodeInstanceServer())
|
|
||||||
nodeInstanceServer()->removeFilePropertyFromFileSystemWatcher(object(), propertyName, path);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QQmlAbstractBinding *binding = QQmlPropertyPrivate::binding(property);
|
|
||||||
if (binding && !(hasValidResetBinding(propertyName) && getResetBinding(propertyName) == binding)) {
|
|
||||||
binding->setEnabled(false, 0);
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
//Refcounting is taking care
|
|
||||||
#else
|
|
||||||
binding->destroy();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (hasValidResetBinding(propertyName)) {
|
|
||||||
QQmlAbstractBinding *binding = getResetBinding(propertyName);
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
QQmlBinding *qmlBinding = dynamic_cast<QQmlBinding*>(binding);
|
|
||||||
if (qmlBinding)
|
|
||||||
qmlBinding->setTarget(property);
|
|
||||||
QQmlPropertyPrivate::setBinding(binding, QQmlPropertyPrivate::None, QQmlPropertyPrivate::DontRemoveBinding);
|
|
||||||
if (qmlBinding)
|
|
||||||
qmlBinding->update();
|
|
||||||
#else
|
|
||||||
QQmlPropertyPrivate::setBinding(property, binding, QQmlPropertyPrivate::DontRemoveBinding);
|
|
||||||
binding->update();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else if (property.isResettable()) {
|
|
||||||
property.reset();
|
|
||||||
} else if (property.propertyTypeCategory() == QQmlProperty::List) {
|
|
||||||
QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
|
|
||||||
|
|
||||||
if (!QmlPrivateGate::hasFullImplementedListInterface(list)) {
|
|
||||||
qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
list.clear();
|
|
||||||
} else if (property.isWritable()) {
|
|
||||||
if (property.read() == getResetValue(propertyName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
property.write(getResetValue(propertyName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesignerCustomObjectData::hasValidResetBinding(const PropertyName &propertyName) const
|
|
||||||
{
|
|
||||||
return m_resetBindingHash.contains(propertyName) && m_resetBindingHash.value(propertyName).data();
|
|
||||||
}
|
|
||||||
|
|
||||||
QQmlAbstractBinding *DesignerCustomObjectData::getResetBinding(const PropertyName &propertyName) const
|
|
||||||
{
|
|
||||||
return m_resetBindingHash.value(propertyName).data();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesignerCustomObjectData::hasBindingForProperty(QQmlContext *context, const PropertyName &propertyName, bool *hasChanged) const
|
|
||||||
{
|
|
||||||
if (QmlPrivateGate::isPropertyBlackListed(propertyName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
|
|
||||||
|
|
||||||
bool hasBinding = QQmlPropertyPrivate::binding(property);
|
|
||||||
|
|
||||||
if (hasChanged) {
|
|
||||||
*hasChanged = hasBinding != m_hasBindingHash.value(propertyName, false);
|
|
||||||
if (*hasChanged)
|
|
||||||
m_hasBindingHash.insert(propertyName, hasBinding);
|
|
||||||
}
|
|
||||||
|
|
||||||
return QQmlPropertyPrivate::binding(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::setPropertyBinding(QQmlContext *context, const PropertyName &propertyName, const QString &expression)
|
|
||||||
{
|
|
||||||
QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
|
|
||||||
|
|
||||||
if (!property.isValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (property.isProperty()) {
|
|
||||||
QQmlBinding *binding = new QQmlBinding(expression, object(), context);
|
|
||||||
binding->setTarget(property);
|
|
||||||
binding->setNotifyOnValueChanged(true);
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
QQmlPropertyPrivate::setBinding(binding, QQmlPropertyPrivate::None, QQmlPropertyPrivate::DontRemoveBinding);
|
|
||||||
//Refcounting is taking take care of deletion
|
|
||||||
#else
|
|
||||||
QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::setBinding(property, binding);
|
|
||||||
if (oldBinding && !hasValidResetBinding(propertyName))
|
|
||||||
oldBinding->destroy();
|
|
||||||
#endif
|
|
||||||
binding->update();
|
|
||||||
if (binding->hasError()) {
|
|
||||||
if (property.property().userType() == QVariant::String)
|
|
||||||
property.write(QVariant(QString("#%1#").arg(expression)));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
qWarning() << Q_FUNC_INFO << ": Cannot set binding for property" << propertyName << ": property is unknown for type";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignerCustomObjectData::keepBindingFromGettingDeleted(
|
|
||||||
[[maybe_unused]] QQmlContext *context, [[maybe_unused]] const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
|
|
||||||
QQmlPropertyPrivate::setBinding(property, 0, QQmlPropertyPrivate::BypassInterceptor
|
|
||||||
| QQmlPropertyPrivate::DontRemoveBinding);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "nodeinstanceglobal.h"
|
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
#include <private/qqmlbinding_p.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QQmlContext;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace QmlPrivateGate {
|
|
||||||
|
|
||||||
class DesignerCustomObjectData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void registerData(QObject *object);
|
|
||||||
static DesignerCustomObjectData *get(QObject *object);
|
|
||||||
static QVariant getResetValue(QObject *object, const PropertyName &propertyName);
|
|
||||||
static void doResetProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName);
|
|
||||||
static bool hasValidResetBinding(QObject *object, const PropertyName &propertyName);
|
|
||||||
static bool hasBindingForProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName, bool *hasChanged);
|
|
||||||
static void setPropertyBinding(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QString &expression);
|
|
||||||
static void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
DesignerCustomObjectData(QObject *object);
|
|
||||||
void populateResetHashes();
|
|
||||||
QObject *object() const;
|
|
||||||
QVariant getResetValue(const PropertyName &propertyName) const;
|
|
||||||
void doResetProperty(QQmlContext *context, const PropertyName &propertyName);
|
|
||||||
bool hasValidResetBinding(const PropertyName &propertyName) const;
|
|
||||||
QQmlAbstractBinding *getResetBinding(const PropertyName &propertyName) const;
|
|
||||||
bool hasBindingForProperty(QQmlContext *context, const PropertyName &propertyName, bool *hasChanged) const;
|
|
||||||
void setPropertyBinding(QQmlContext *context, const PropertyName &propertyName, const QString &expression);
|
|
||||||
void keepBindingFromGettingDeleted(QQmlContext *context, const PropertyName &propertyName);
|
|
||||||
|
|
||||||
QObject *m_object;
|
|
||||||
QHash<PropertyName, QVariant> m_resetValueHash;
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
QHash<PropertyName, QQmlAbstractBinding::Ptr> m_resetBindingHash;
|
|
||||||
#else
|
|
||||||
QHash<PropertyName, QWeakPointer<QQmlAbstractBinding> > m_resetBindingHash;
|
|
||||||
#endif
|
|
||||||
mutable QHash<PropertyName, bool> m_hasBindingHash;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
#include <private/qquickdesignersupport_p.h>
|
|
||||||
#else
|
|
||||||
#include <designersupport.h>
|
|
||||||
#endif
|
|
||||||
@@ -1,358 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "metaobject.h"
|
|
||||||
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QMetaProperty>
|
|
||||||
#include <qnumeric.h>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <private/qqmlengine_p.h>
|
|
||||||
#include <private/qqmlpropertycache_p.h>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace QmlPrivateGate {
|
|
||||||
|
|
||||||
static QHash<QDynamicMetaObjectData *, bool> nodeInstanceMetaObjectList;
|
|
||||||
static void (*notifyPropertyChangeCallBack)(QObject*, const PropertyName &propertyName) = 0;
|
|
||||||
|
|
||||||
struct MetaPropertyData {
|
|
||||||
inline QPair<QVariant, bool> &getDataRef(int idx) {
|
|
||||||
while (m_data.count() <= idx)
|
|
||||||
m_data << QPair<QVariant, bool>(QVariant(), false);
|
|
||||||
return m_data[idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QVariant &getData(int idx) {
|
|
||||||
QPair<QVariant, bool> &prop = getDataRef(idx);
|
|
||||||
if (!prop.second) {
|
|
||||||
prop.first = QVariant();
|
|
||||||
prop.second = true;
|
|
||||||
}
|
|
||||||
return prop.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool hasData(int idx) const {
|
|
||||||
if (idx >= m_data.count())
|
|
||||||
return false;
|
|
||||||
return m_data[idx].second;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int count() { return m_data.count(); }
|
|
||||||
|
|
||||||
QList<QPair<QVariant, bool> > m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool constructedMetaData(const QQmlVMEMetaData* data)
|
|
||||||
{
|
|
||||||
return data->propertyCount == 0
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
&& data->varPropertyCount == 0
|
|
||||||
#endif
|
|
||||||
&& data->aliasCount == 0
|
|
||||||
&& data->signalCount == 0
|
|
||||||
&& data->methodCount == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QQmlVMEMetaData* fakeMetaData()
|
|
||||||
{
|
|
||||||
QQmlVMEMetaData* data = new QQmlVMEMetaData;
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
data->varPropertyCount = 0;
|
|
||||||
#endif
|
|
||||||
data->propertyCount = 0;
|
|
||||||
data->aliasCount = 0;
|
|
||||||
data->signalCount = 0;
|
|
||||||
data->methodCount = 0;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const QQmlVMEMetaData* vMEMetaDataForObject(QObject *object)
|
|
||||||
{
|
|
||||||
QQmlVMEMetaObject *metaObject = QQmlVMEMetaObject::get(object);
|
|
||||||
if (metaObject)
|
|
||||||
return metaObject->metaData;
|
|
||||||
|
|
||||||
return fakeMetaData();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QQmlPropertyCache *cacheForObject(QObject *object, QQmlEngine *engine)
|
|
||||||
{
|
|
||||||
QQmlVMEMetaObject *metaObject = QQmlVMEMetaObject::get(object);
|
|
||||||
if (metaObject)
|
|
||||||
return metaObject->cache;
|
|
||||||
|
|
||||||
return QQmlEnginePrivate::get(engine)->cache(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaObject* MetaObject::getNodeInstanceMetaObject(QObject *object, QQmlEngine *engine)
|
|
||||||
{
|
|
||||||
//Avoid setting up multiple MetaObjects on the same QObject
|
|
||||||
QObjectPrivate *op = QObjectPrivate::get(object);
|
|
||||||
QDynamicMetaObjectData *parent = op->metaObject;
|
|
||||||
if (nodeInstanceMetaObjectList.contains(parent))
|
|
||||||
return static_cast<MetaObject *>(parent);
|
|
||||||
|
|
||||||
// we just create one and the ownership goes automatically to the object in nodeinstance see init method
|
|
||||||
return new MetaObject(object, engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::init(QObject *object, QQmlEngine *engine)
|
|
||||||
{
|
|
||||||
//Creating QQmlOpenMetaObjectType
|
|
||||||
m_type = new QQmlOpenMetaObjectType(metaObjectParent(), engine);
|
|
||||||
m_type->addref();
|
|
||||||
//Assigning type to this
|
|
||||||
copyTypeMetaObject();
|
|
||||||
|
|
||||||
//Assign this to object
|
|
||||||
QObjectPrivate *op = QObjectPrivate::get(object);
|
|
||||||
op->metaObject = this;
|
|
||||||
|
|
||||||
//create cache
|
|
||||||
cache = m_cache = QQmlEnginePrivate::get(engine)->cache(this);
|
|
||||||
cache->addref();
|
|
||||||
|
|
||||||
//If our parent is not a VMEMetaObject we just se the flag to false again
|
|
||||||
if (constructedMetaData(metaData))
|
|
||||||
QQmlData::get(object)->hasVMEMetaObject = false;
|
|
||||||
|
|
||||||
nodeInstanceMetaObjectList.insert(this, true);
|
|
||||||
hasAssignedMetaObjectData = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaObject::MetaObject(QObject *object, QQmlEngine *engine)
|
|
||||||
: QQmlVMEMetaObject(object, cacheForObject(object, engine), vMEMetaDataForObject(object)),
|
|
||||||
m_context(engine->contextForObject(object)),
|
|
||||||
m_data(new MetaPropertyData),
|
|
||||||
m_cache(0)
|
|
||||||
{
|
|
||||||
init(object, engine);
|
|
||||||
|
|
||||||
QQmlData *ddata = QQmlData::get(object, false);
|
|
||||||
|
|
||||||
//Assign cache to object
|
|
||||||
if (ddata && ddata->propertyCache) {
|
|
||||||
cache->setParent(ddata->propertyCache);
|
|
||||||
cache->invalidate(engine, this);
|
|
||||||
ddata->propertyCache = m_cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaObject::~MetaObject()
|
|
||||||
{
|
|
||||||
if (cache->count() > 1) // qml is crashing because the property cache is not removed from the engine
|
|
||||||
cache->release();
|
|
||||||
else
|
|
||||||
m_type->release();
|
|
||||||
|
|
||||||
nodeInstanceMetaObjectList.remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::createNewDynamicProperty(const QString &name)
|
|
||||||
{
|
|
||||||
[[maybe_unused]] int id = m_type->createProperty(name.toUtf8());
|
|
||||||
copyTypeMetaObject();
|
|
||||||
setValue(id, QVariant());
|
|
||||||
Q_ASSERT(id >= 0);
|
|
||||||
|
|
||||||
//Updating cache
|
|
||||||
QQmlPropertyCache *oldParent = m_cache->parent();
|
|
||||||
QQmlEnginePrivate::get(m_context->engine())->cache(this)->invalidate(m_context->engine(), this);
|
|
||||||
m_cache->setParent(oldParent);
|
|
||||||
|
|
||||||
QQmlProperty property(myObject(), name, m_context);
|
|
||||||
Q_ASSERT(property.isValid());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::setValue(int id, const QVariant &value)
|
|
||||||
{
|
|
||||||
QPair<QVariant, bool> &prop = m_data->getDataRef(id);
|
|
||||||
prop.first = propertyWriteValue(id, value);
|
|
||||||
prop.second = true;
|
|
||||||
QMetaObject::activate(myObject(), id + m_type->signalOffset(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant MetaObject::propertyWriteValue(int, const QVariant &value)
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QAbstractDynamicMetaObject *MetaObject::dynamicMetaObjectParent() const
|
|
||||||
{
|
|
||||||
if (QQmlVMEMetaObject::parent.isT1())
|
|
||||||
return QQmlVMEMetaObject::parent.asT1()->toDynamicMetaObject(QQmlVMEMetaObject::object);
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QMetaObject *MetaObject::metaObjectParent() const
|
|
||||||
{
|
|
||||||
if (QQmlVMEMetaObject::parent.isT1())
|
|
||||||
return QQmlVMEMetaObject::parent.asT1()->toDynamicMetaObject(QQmlVMEMetaObject::object);
|
|
||||||
|
|
||||||
return QQmlVMEMetaObject::parent.asT2();
|
|
||||||
}
|
|
||||||
|
|
||||||
int MetaObject::propertyOffset() const
|
|
||||||
{
|
|
||||||
return cache->propertyOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
int MetaObject::openMetaCall(QMetaObject::Call call, int id, void **a)
|
|
||||||
{
|
|
||||||
if ((call == QMetaObject::ReadProperty || call == QMetaObject::WriteProperty)
|
|
||||||
&& id >= m_type->propertyOffset()) {
|
|
||||||
int propId = id - m_type->propertyOffset();
|
|
||||||
if (call == QMetaObject::ReadProperty) {
|
|
||||||
//propertyRead(propId);
|
|
||||||
*reinterpret_cast<QVariant *>(a[0]) = m_data->getData(propId);
|
|
||||||
} else if (call == QMetaObject::WriteProperty) {
|
|
||||||
if (propId <= m_data->count() || m_data->m_data[propId].first != *reinterpret_cast<QVariant *>(a[0])) {
|
|
||||||
//propertyWrite(propId);
|
|
||||||
QPair<QVariant, bool> &prop = m_data->getDataRef(propId);
|
|
||||||
prop.first = propertyWriteValue(propId, *reinterpret_cast<QVariant *>(a[0]));
|
|
||||||
prop.second = true;
|
|
||||||
//propertyWritten(propId);
|
|
||||||
activate(myObject(), m_type->signalOffset() + propId, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
QAbstractDynamicMetaObject *directParent = parent();
|
|
||||||
if (directParent)
|
|
||||||
return directParent->metaCall(call, id, a);
|
|
||||||
else
|
|
||||||
return myObject()->qt_metacall(call, id, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int MetaObject::metaCall(QMetaObject::Call call, int id, void **a)
|
|
||||||
{
|
|
||||||
int metaCallReturnValue = -1;
|
|
||||||
|
|
||||||
const QMetaProperty propertyById = QQmlVMEMetaObject::property(id);
|
|
||||||
|
|
||||||
if (call == QMetaObject::WriteProperty
|
|
||||||
&& propertyById.userType() == QMetaType::QVariant
|
|
||||||
&& reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double
|
|
||||||
&& qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (call == QMetaObject::WriteProperty
|
|
||||||
&& propertyById.userType() == QMetaType::Double
|
|
||||||
&& qIsNaN(*reinterpret_cast<double*>(a[0]))) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (call == QMetaObject::WriteProperty
|
|
||||||
&& propertyById.userType() == QMetaType::Float
|
|
||||||
&& qIsNaN(*reinterpret_cast<float*>(a[0]))) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant oldValue;
|
|
||||||
|
|
||||||
if (call == QMetaObject::WriteProperty && !propertyById.hasNotifySignal())
|
|
||||||
{
|
|
||||||
oldValue = propertyById.read(myObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractDynamicMetaObject *directParent = parent();
|
|
||||||
if (directParent && id < directParent->propertyOffset()) {
|
|
||||||
metaCallReturnValue = directParent->metaCall(call, id, a);
|
|
||||||
} else {
|
|
||||||
openMetaCall(call, id, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ((call == QMetaObject::WriteProperty || call == QMetaObject::ReadProperty) && metaCallReturnValue < 0) {
|
|
||||||
if (objectNodeInstance
|
|
||||||
&& objectNodeInstance->nodeInstanceServer()
|
|
||||||
&& objectNodeInstance->nodeInstanceServer()->dummyContextObject()
|
|
||||||
&& !(objectNodeInstance && !objectNodeInstance->isRootNodeInstance()
|
|
||||||
&& property(id).name() == QLatin1String("parent"))) {
|
|
||||||
|
|
||||||
QObject *contextDummyObject = objectNodeInstance->nodeInstanceServer()->dummyContextObject();
|
|
||||||
int propertyIndex = contextDummyObject->metaObject()->indexOfProperty(propertyById.name());
|
|
||||||
if (propertyIndex >= 0)
|
|
||||||
metaCallReturnValue = contextDummyObject->qt_metacall(call, propertyIndex, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (call == QMetaObject::WriteProperty
|
|
||||||
&& !propertyById.hasNotifySignal()
|
|
||||||
&& oldValue != propertyById.read(myObject()))
|
|
||||||
notifyPropertyChange(id);
|
|
||||||
|
|
||||||
return metaCallReturnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::notifyPropertyChange(int id)
|
|
||||||
{
|
|
||||||
const QMetaProperty propertyById = property(id);
|
|
||||||
|
|
||||||
if (id < propertyOffset()) {
|
|
||||||
if (notifyPropertyChangeCallBack)
|
|
||||||
notifyPropertyChangeCallBack(myObject(), propertyById.name());
|
|
||||||
} else {
|
|
||||||
if (notifyPropertyChangeCallBack)
|
|
||||||
notifyPropertyChangeCallBack(myObject(), name(id - propertyOffset()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int MetaObject::count() const
|
|
||||||
{
|
|
||||||
return m_type->propertyCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray MetaObject::name(int idx) const
|
|
||||||
{
|
|
||||||
return m_type->propertyName(idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::copyTypeMetaObject()
|
|
||||||
{
|
|
||||||
*static_cast<QMetaObject *>(this) = *m_type->metaObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetaObject::registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &))
|
|
||||||
{
|
|
||||||
notifyPropertyChangeCallBack = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QScopedPointer>
|
|
||||||
#include <private/qqmlopenmetaobject_p.h>
|
|
||||||
#include <private/qqmlvmemetaobject_p.h>
|
|
||||||
|
|
||||||
#include "nodeinstanceglobal.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace QmlPrivateGate {
|
|
||||||
|
|
||||||
void createNewDynamicProperty(QObject *object, QQmlEngine *engine, const QString &name);
|
|
||||||
void registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine);
|
|
||||||
|
|
||||||
struct MetaPropertyData;
|
|
||||||
|
|
||||||
class MetaObject : public QQmlVMEMetaObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~MetaObject() override;
|
|
||||||
|
|
||||||
static void registerNotifyPropertyChangeCallBack(void (*callback)(QObject*, const PropertyName &propertyName));
|
|
||||||
|
|
||||||
protected:
|
|
||||||
MetaObject(QObject *object, QQmlEngine *engine);
|
|
||||||
static MetaObject* getNodeInstanceMetaObject(QObject *object, QQmlEngine *engine);
|
|
||||||
|
|
||||||
void createNewDynamicProperty(const QString &name);
|
|
||||||
int openMetaCall(QMetaObject::Call _c, int _id, void **_a);
|
|
||||||
using QQmlVMEMetaObject::metaCall;
|
|
||||||
int metaCall(QMetaObject::Call _c, int _id, void **_a) override;
|
|
||||||
void notifyPropertyChange(int id);
|
|
||||||
void setValue(int id, const QVariant &value);
|
|
||||||
QVariant propertyWriteValue(int, const QVariant &);
|
|
||||||
|
|
||||||
QObject *myObject() const { return QQmlVMEMetaObject::object; }
|
|
||||||
QAbstractDynamicMetaObject *parent() const { return const_cast<QAbstractDynamicMetaObject *>(dynamicMetaObjectParent()); }
|
|
||||||
|
|
||||||
const QAbstractDynamicMetaObject *dynamicMetaObjectParent() const;
|
|
||||||
|
|
||||||
const QMetaObject *metaObjectParent() const;
|
|
||||||
|
|
||||||
int propertyOffset() const;
|
|
||||||
|
|
||||||
int count() const;
|
|
||||||
QByteArray name(int) const;
|
|
||||||
|
|
||||||
void copyTypeMetaObject();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void init(QObject *, QQmlEngine *engine);
|
|
||||||
|
|
||||||
QPointer<QQmlContext> m_context;
|
|
||||||
QQmlOpenMetaObjectType *m_type;
|
|
||||||
QScopedPointer<MetaPropertyData> m_data;
|
|
||||||
//QAbstractDynamicMetaObject *m_parent;
|
|
||||||
QQmlPropertyCache *m_cache;
|
|
||||||
|
|
||||||
|
|
||||||
friend void createNewDynamicProperty(QObject *object, QQmlEngine *engine, const QString &name);
|
|
||||||
friend void registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,45 +1,7 @@
|
|||||||
INCLUDEPATH += $$PWD/
|
INCLUDEPATH += $$PWD/
|
||||||
|
|
||||||
# in case we are building the puppet inside qtcreator we don't have the qtcreator.pri where this function comes from
|
|
||||||
defineTest(minQtVersion) {
|
|
||||||
maj = $$1
|
|
||||||
min = $$2
|
|
||||||
patch = $$3
|
|
||||||
isEqual(QT_MAJOR_VERSION, $$maj) {
|
|
||||||
isEqual(QT_MINOR_VERSION, $$min) {
|
|
||||||
isEqual(QT_PATCH_VERSION, $$patch) {
|
|
||||||
return(true)
|
|
||||||
}
|
|
||||||
greaterThan(QT_PATCH_VERSION, $$patch) {
|
|
||||||
return(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
greaterThan(QT_MINOR_VERSION, $$min) {
|
|
||||||
return(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
greaterThan(QT_MAJOR_VERSION, $$maj) {
|
|
||||||
return(true)
|
|
||||||
}
|
|
||||||
return(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
minQtVersion(5, 6, 0) {
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/qmlprivategate.h
|
$$PWD/qmlprivategate.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/qmlprivategate_56.cpp
|
$$PWD/qmlprivategate.cpp
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
$$PWD/qmlprivategate.h \
|
|
||||||
$$PWD/metaobject.h \
|
|
||||||
$$PWD/designercustomobjectdata.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
$$PWD/qmlprivategate.cpp \
|
|
||||||
$$PWD/metaobject.cpp \
|
|
||||||
$$PWD/designercustomobjectdata.cpp
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,647 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qmlprivategate.h"
|
|
||||||
|
|
||||||
#include "designercustomobjectdata.h"
|
|
||||||
|
|
||||||
#include <objectnodeinstance.h>
|
|
||||||
#include <nodeinstanceserver.h>
|
|
||||||
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QQmlComponent>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
|
|
||||||
#include <private/qabstractfileengine_p.h>
|
|
||||||
#include <private/qfsfileengine_p.h>
|
|
||||||
|
|
||||||
#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>
|
|
||||||
#include <private/qqmldata_p.h>
|
|
||||||
#include <private/qqmlcomponentattached_p.h>
|
|
||||||
|
|
||||||
#include <private/qabstractanimation_p.h>
|
|
||||||
#include <private/qobject_p.h>
|
|
||||||
#include <private/qquickbehavior_p.h>
|
|
||||||
#include <private/qquicktext_p.h>
|
|
||||||
#include <private/qquicktextinput_p.h>
|
|
||||||
#include <private/qquicktextedit_p.h>
|
|
||||||
#include <private/qquicktransition_p.h>
|
|
||||||
#include <private/qquickloader_p.h>
|
|
||||||
|
|
||||||
#include <private/qquickanimation_p.h>
|
|
||||||
#include <private/qqmlmetatype_p.h>
|
|
||||||
#include <private/qqmltimer_p.h>
|
|
||||||
|
|
||||||
#ifdef QUICK3D_MODULE
|
|
||||||
#include <private/qquick3dobject_p.h>
|
|
||||||
#include <private/qquick3drepeater_p.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace QmlPrivateGate {
|
|
||||||
|
|
||||||
bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
return QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
|
||||||
|
|
||||||
static void addToPropertyNameListIfNotBlackListed(
|
|
||||||
PropertyNameList *propertyNameList, const QQuickDesignerSupport::PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
if (!QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName))
|
|
||||||
propertyNameList->append(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyNameList allPropertyNamesInline(QObject *object,
|
|
||||||
const PropertyName &baseName = {},
|
|
||||||
QObjectList *inspectedObjects = nullptr,
|
|
||||||
int depth = 0)
|
|
||||||
{
|
|
||||||
QQuickDesignerSupport::PropertyNameList propertyNameList;
|
|
||||||
|
|
||||||
QObjectList localObjectList;
|
|
||||||
|
|
||||||
if (inspectedObjects == nullptr)
|
|
||||||
inspectedObjects = &localObjectList;
|
|
||||||
|
|
||||||
if (depth > 2)
|
|
||||||
return propertyNameList;
|
|
||||||
|
|
||||||
if (!inspectedObjects->contains(object))
|
|
||||||
inspectedObjects->append(object);
|
|
||||||
|
|
||||||
const QMetaObject *metaObject = object->metaObject();
|
|
||||||
|
|
||||||
QStringList deferredPropertyNames;
|
|
||||||
const int namesIndex = metaObject->indexOfClassInfo("DeferredPropertyNames");
|
|
||||||
if (namesIndex != -1) {
|
|
||||||
QMetaClassInfo classInfo = metaObject->classInfo(namesIndex);
|
|
||||||
deferredPropertyNames = QString::fromUtf8(classInfo.value()).split(QLatin1Char(','));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = 0; index < metaObject->propertyCount(); ++index) {
|
|
||||||
QMetaProperty metaProperty = metaObject->property(index);
|
|
||||||
QQmlProperty declarativeProperty(object, QString::fromUtf8(metaProperty.name()));
|
|
||||||
if (declarativeProperty.isValid()
|
|
||||||
&& declarativeProperty.propertyTypeCategory() == QQmlProperty::Object) {
|
|
||||||
if (declarativeProperty.name() != QLatin1String("parent")
|
|
||||||
&& !deferredPropertyNames.contains(declarativeProperty.name())) {
|
|
||||||
QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read());
|
|
||||||
if (childObject)
|
|
||||||
propertyNameList.append(
|
|
||||||
allPropertyNamesInline(childObject,
|
|
||||||
baseName
|
|
||||||
+ QQuickDesignerSupport::PropertyName(
|
|
||||||
metaProperty.name())
|
|
||||||
+ '.',
|
|
||||||
inspectedObjects,
|
|
||||||
depth + 1));
|
|
||||||
}
|
|
||||||
} else if (QQmlGadgetPtrWrapper *valueType
|
|
||||||
= QQmlGadgetPtrWrapper::instance(qmlEngine(object), metaProperty.userType())) {
|
|
||||||
valueType->setValue(metaProperty.read(object));
|
|
||||||
propertyNameList.append(baseName
|
|
||||||
+ QQuickDesignerSupport::PropertyName(metaProperty.name()));
|
|
||||||
propertyNameList.append(
|
|
||||||
allPropertyNamesInline(valueType,
|
|
||||||
baseName
|
|
||||||
+ QQuickDesignerSupport::PropertyName(metaProperty.name())
|
|
||||||
+ '.',
|
|
||||||
inspectedObjects,
|
|
||||||
depth + 1));
|
|
||||||
} else {
|
|
||||||
addToPropertyNameListIfNotBlackListed(&propertyNameList,
|
|
||||||
baseName
|
|
||||||
+ QQuickDesignerSupport::PropertyName(
|
|
||||||
metaProperty.name()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return propertyNameList;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PropertyNameList allPropertyNames(QObject *object)
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
return QQuickDesignerSupportProperties::allPropertyNames(object);
|
|
||||||
#elif QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
return allPropertyNamesInline(object);
|
|
||||||
#else
|
|
||||||
return QQuickDesignerSupportProperties::allPropertyNames(object);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyNameList propertyNameListForWritableProperties(QObject *object)
|
|
||||||
{
|
|
||||||
return QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isMetaObjectofType(const QMetaObject *metaObject, const QByteArray &type)
|
|
||||||
{
|
|
||||||
if (metaObject) {
|
|
||||||
if (metaObject->className() == type)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return isMetaObjectofType(metaObject->superClass(), type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isQuickStyleItem(QObject *object)
|
|
||||||
{
|
|
||||||
if (object)
|
|
||||||
return isMetaObjectofType(object->metaObject(), "QQuickStyleItem");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isDelegateModel(QObject *object)
|
|
||||||
{
|
|
||||||
if (object)
|
|
||||||
return isMetaObjectofType(object->metaObject(), "QQmlDelegateModel");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is used in share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
|
|
||||||
QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context)
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
|
|
||||||
QTypeRevision revision = QTypeRevision::zero();
|
|
||||||
if (majorNumber > 0)
|
|
||||||
revision = QTypeRevision::fromVersion(majorNumber, minorNumber);
|
|
||||||
return QQuickDesignerSupportItems::createPrimitive(typeName, revision, context);
|
|
||||||
#else
|
|
||||||
return QQuickDesignerSupportItems::createPrimitive(typeName, majorNumber, minorNumber, context);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString qmlDesignerRCPath()
|
|
||||||
{
|
|
||||||
static const QString qmlDesignerRcPathsString = QString::fromLocal8Bit(
|
|
||||||
qgetenv("QMLDESIGNER_RC_PATHS"));
|
|
||||||
return qmlDesignerRcPathsString;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
if (!qmlDesignerRCPath().isEmpty()) {
|
|
||||||
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
|
||||||
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('/'));
|
|
||||||
if (QFileInfo::exists(fixedPath)) {
|
|
||||||
fixedPath.replace(QLatin1String("//"), QLatin1String("/"));
|
|
||||||
fixedPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
|
||||||
return QUrl::fromLocalFile(fixedPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (value.type() == QVariant::String) {
|
|
||||||
const QString str = value.toString();
|
|
||||||
if (str.contains(QLatin1String("qrc:"))) {
|
|
||||||
if (!qmlDesignerRCPath().isEmpty()) {
|
|
||||||
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
|
||||||
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('/'));
|
|
||||||
if (QFileInfo::exists(fixedPath)) {
|
|
||||||
fixedPath.replace(QLatin1String("//"), QLatin1String("/"));
|
|
||||||
fixedPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
|
||||||
return QUrl::fromLocalFile(fixedPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
QQmlProperty property(object, QString::fromUtf8(propertyName), context);
|
|
||||||
property.write(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doResetProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasValidResetBinding(QObject *object, const PropertyName &propertyName)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void emitComponentComplete(QObject *item)
|
|
||||||
{
|
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QQmlData *data = QQmlData::get(item);
|
|
||||||
if (data && data->context) {
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QQmlComponentAttached *componentAttached = data->context->componentAttached;
|
|
||||||
#else
|
|
||||||
QQmlComponentAttached *componentAttached = data->context->componentAttacheds();
|
|
||||||
#endif
|
|
||||||
while (componentAttached) {
|
|
||||||
if (componentAttached->parent())
|
|
||||||
if (componentAttached->parent() == item)
|
|
||||||
emit componentAttached->completed();
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
componentAttached = componentAttached->next;
|
|
||||||
#else
|
|
||||||
componentAttached = componentAttached->next();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer)
|
|
||||||
{
|
|
||||||
if (object) {
|
|
||||||
QQuickItem *item = qobject_cast<QQuickItem*>(object);
|
|
||||||
|
|
||||||
if (item && DesignerSupport::isComponentComplete(item))
|
|
||||||
return;
|
|
||||||
#ifdef QUICK3D_MODULE
|
|
||||||
auto obj3d = qobject_cast<QQuick3DRepeater *>(object);
|
|
||||||
if (obj3d && QQuick3DObjectPrivate::get(obj3d)->componentComplete)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!nodeInstanceServer->hasInstanceForObject(item))
|
|
||||||
emitComponentComplete(object);
|
|
||||||
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 (!isQuickStyleItem(object) && !isDelegateModel(object)) {
|
|
||||||
if (item) {
|
|
||||||
static_cast<QQmlParserStatus *>(item)->componentComplete();
|
|
||||||
} else {
|
|
||||||
QQmlParserStatus *qmlParserStatus = dynamic_cast<QQmlParserStatus *>(object);
|
|
||||||
if (qmlParserStatus) {
|
|
||||||
qmlParserStatus->componentComplete();
|
|
||||||
auto *anim = dynamic_cast<QQuickAbstractAnimation *>(object);
|
|
||||||
if (anim && ViewConfig::isParticleViewMode()) {
|
|
||||||
nodeInstanceServer->addAnimation(anim);
|
|
||||||
anim->setEnableUserControl();
|
|
||||||
anim->stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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, [[maybe_unused]] QQmlEngine *engine)
|
|
||||||
{
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
|
||||||
QQuickDesignerSupportProperties::getPropertyCache(object, engine);
|
|
||||||
#else
|
|
||||||
QQuickDesignerSupportProperties::getPropertyCache(object);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &))
|
|
||||||
{
|
|
||||||
QQuickDesignerSupportMetaInfo::registerNotifyPropertyChangeCallBack(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentCompleteDisabler::ComponentCompleteDisabler()
|
|
||||||
{
|
|
||||||
DesignerSupport::disableComponentComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentCompleteDisabler::~ComponentCompleteDisabler()
|
|
||||||
{
|
|
||||||
DesignerSupport::enableComponentComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
class QrcEngineHandler : public QAbstractFileEngineHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QAbstractFileEngine *create(const QString &fileName) const final;
|
|
||||||
};
|
|
||||||
|
|
||||||
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() + '/');
|
|
||||||
|
|
||||||
if (fileName == fixedPath)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
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; }
|
|
||||||
};
|
|
||||||
|
|
||||||
void registerFixResourcePathsForObjectCallBack()
|
|
||||||
{
|
|
||||||
static EngineHandlerDeleter deleter;
|
|
||||||
|
|
||||||
if (!s_qrcEngineHandler)
|
|
||||||
s_qrcEngineHandler = new QrcEngineHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -254,8 +254,7 @@ extend_qtc_executable(qml2puppet
|
|||||||
extend_qtc_executable(qml2puppet
|
extend_qtc_executable(qml2puppet
|
||||||
SOURCES_PREFIX "${SRCDIR}/qmlprivategate"
|
SOURCES_PREFIX "${SRCDIR}/qmlprivategate"
|
||||||
SOURCES
|
SOURCES
|
||||||
designersupportdelegate.h
|
qmlprivategate.cpp qmlprivategate.h
|
||||||
qmlprivategate_56.cpp qmlprivategate.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY AND Qt6_VERSION VERSION_GREATER_EQUAL 6.2.1)
|
if(DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY AND Qt6_VERSION VERSION_GREATER_EQUAL 6.2.1)
|
||||||
|
|||||||
@@ -304,19 +304,6 @@ QtcTool {
|
|||||||
condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.6.0")
|
condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.6.0")
|
||||||
prefix: puppetDir + "/qmlprivategate/"
|
prefix: puppetDir + "/qmlprivategate/"
|
||||||
files: [
|
files: [
|
||||||
"qmlprivategate_56.cpp",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
Group {
|
|
||||||
name: "qmlprivategate (old)"
|
|
||||||
condition: !QtcFunctions.versionIsAtLeast(Qt.core.version, "5.6.0")
|
|
||||||
prefix: puppetDir + "/qmlprivategate/"
|
|
||||||
files: [
|
|
||||||
"designercustomobjectdata.cpp",
|
|
||||||
"designercustomobjectdata.h",
|
|
||||||
"metaobject.cpp",
|
|
||||||
"metaobject.h",
|
|
||||||
"qmlprivategate.cpp",
|
"qmlprivategate.cpp",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user