diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp index f4a3f31f3079f63f5652abe53f9143e06cd234e4..04c96cc8980534be28430f06502077afaa899217 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp @@ -94,11 +94,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & if (metaProperty.isReadable() && QDeclarativeMetaType::isList(metaProperty.userType())) { QDeclarativeListReference list(spiedObject, metaProperty.name()); -#if QT_VERSION<0x050000 if (list.canCount() && list.canAt()) { -#else - if (list.isReadable()) { -#endif for (int i = 0; i < list.count(); i++) { QObject *propertyObject = list.at(i); if (propertyObject) diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp index 2b94d7bb8f95f1f99b75c813be180f26e2cd7227..ad48548cbe154d787f8d54cdc71bccd69dbee520 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp @@ -287,12 +287,8 @@ static QVariant objectToVariant(QObject *object) static bool hasFullImplementedListInterface(const QDeclarativeListReference &list) { - -#if QT_VERSION<0x050000 return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear(); -#else - return list.isChangeable(); -#endif + } static void removeObjectFromList(const QDeclarativeProperty &property, QObject *objectToBeRemoved, QDeclarativeEngine * engine) @@ -543,7 +539,11 @@ void ObjectNodeInstance::refreshProperty(const QString &name) property.write(resetValue(name)); if (oldValue.type() == QVariant::Url) { +#if QT_VERSION >= 0x050000 + QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100)); +#else QByteArray key = oldValue.toUrl().toEncoded(QUrl::FormattingOption(0x100)); +#endif QString pixmapKey = QString::fromLatin1(key.constData(), key.count()); QPixmapCache::remove(pixmapKey); } @@ -774,11 +774,7 @@ void allSubObject(QObject *object, QObjectList &objectList) if (metaProperty.isReadable() && QDeclarativeMetaType::isList(metaProperty.userType())) { QDeclarativeListReference list(object, metaProperty.name()); -#if QT_VERSION<0x050000 if (list.canCount() && list.canAt()) { -#else - if (list.isReadable()) { -#endif for (int i = 0; i < list.count(); i++) { QObject *propertyObject = list.at(i); allSubObject(propertyObject, objectList); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp index 383d53446dcc4634e9c51a2a5049c71d2a7ee767..0721db415d6706407c2e5b3c37d5d86d6cb72b08 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp @@ -38,12 +38,8 @@ #include "qmlstatenodeinstance.h" #include "anchorchangesnodeinstance.h" -#if QT_VERSION >= 0x050000 -#include "sgitemnodeinstance.h" -#else #include "qmlgraphicsitemnodeinstance.h" #include "positionernodeinstance.h" -#endif #include "nodeinstanceserver.h" #include "instancecontainer.h" @@ -52,10 +48,6 @@ #include <QSet> #include <QDebug> -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -#include <QSGItem> -#endif - #include <QDeclarativeEngine> /*! @@ -178,15 +170,10 @@ Internal::ObjectNodeInstance::Pointer ServerNodeInstance::createInstance(QObject if (objectToBeWrapped == 0) instance = Internal::DummyNodeInstance::create(); -#if QT_VERSION >= 0x050000 - else if (isSubclassOf(objectToBeWrapped, "QSGItem")) - instance = Internal::SGItemNodeInstance::create(objectToBeWrapped); -#else else if (isSubclassOf(objectToBeWrapped, "QDeclarativeBasePositioner")) instance = Internal::PositionerNodeInstance::create(objectToBeWrapped); else if (isSubclassOf(objectToBeWrapped, "QDeclarativeItem")) instance = Internal::QmlGraphicsItemNodeInstance::create(objectToBeWrapped); -#endif else if (isSubclassOf(objectToBeWrapped, "QDeclarativeComponent")) instance = Internal::ComponentNodeInstance::create(objectToBeWrapped); else if (objectToBeWrapped->inherits("QDeclarativeAnchorChanges")) @@ -225,11 +212,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe } if ((object == 0) && (instanceContainer.metaType() == InstanceContainer::ItemMetaType)) //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead. -#if QT_VERSION >= 0x050000 - object = Internal::ObjectNodeInstance::createPrimitive("QSGItem", 2, 0, nodeInstanceServer->context()); -#else object = Internal::ObjectNodeInstance::createPrimitive("QtQuick/Item", 1, 0, nodeInstanceServer->context()); -#endif ServerNodeInstance instance(createInstance(object)); @@ -550,13 +533,6 @@ QObject *ServerNodeInstance::internalObject() const return m_nodeInstance->object(); } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -QSGItem *ServerNodeInstance::internalSGItem() const -{ - return qobject_cast<QSGItem*>(internalObject()); -} -#endif - void ServerNodeInstance::activateState() { m_nodeInstance->activateState(); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h index 157fe56f08150ea2bd9cbe34d0aed906a06bbaae..a2c9d28a9aff0fbd4aed0f1da5f6010a13f2a23f 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h @@ -44,9 +44,6 @@ class QStyleOptionGraphicsItem; class QDeclarativeContext; class QGraphicsItem; class QGraphicsTransform; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -class QSGItem; -#endif QT_END_NAMESPACE namespace QmlDesigner { @@ -199,9 +196,6 @@ private: // functions QObject *internalObject() const; // should be not used outside of the nodeinstances!!!! -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - QSGItem *internalSGItem() const; -#endif private: // variables QSharedPointer<Internal::ObjectNodeInstance> m_nodeInstance; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri b/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri index 1975d386c5a2b72b1a41010a7fd90078564775d1..ab4ffb3a453c9bcd60a217bcccb8acf57084d4ab 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri @@ -1,4 +1,10 @@ -QT += core gui declarative network +QT += core gui network + +greaterThan(QT_MAJOR_VERSION, 4) { + QT += quick1 quick1-private core-private widgets-private gui-private script-private +} else { + QT += declarative +} contains (QT_CONFIG, webkit) { QT += webkit diff --git a/src/tools/qmlpuppet/qmlpuppet.pro b/src/tools/qmlpuppet/qmlpuppet.pro index 8fadbfe12f9ef34e8b2d4d1a91c1a615d8e57c8d..1041787b7a2a20a3143588c74603318b6d13d84d 100644 --- a/src/tools/qmlpuppet/qmlpuppet.pro +++ b/src/tools/qmlpuppet/qmlpuppet.pro @@ -3,8 +3,13 @@ TEMPLATE = subdirs include(../../../qtcreator.pri) include(../../private_headers.pri) -exists($${QT_PRIVATE_HEADERS}/QtDeclarative/private/qdeclarativecontext_p.h) { - minQtVersion(4, 7, 1) { - SUBDIRS += qmlpuppet +greaterThan(QT_MAJOR_VERSION, 4) { + QT += qtquick1-private core-private + SUBDIRS += qmlpuppet +} else { + exists($${QT_PRIVATE_HEADERS}/QtDeclarative/private/qdeclarativecontext_p.h) { + minQtVersion(4, 7, 1) { + SUBDIRS += qmlpuppet + } } }