forked from qt-creator/qt-creator
QmlDesigner: compile fix qmlpuppet with Qt 5
This patch allows compiling the qml(1)puppet with Qt 5. Some minor fixes for private headers, cleaning up some old code and QUrl::UrlFormattingOption got renamed. Change-Id: I732f9f9ef0b831d09134b1d2c013efda55e36e11 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user