forked from qt-creator/qt-creator
QmlPuppet: Make compile without QT_RESTRICTED_CAST_FROM_ASCII removed
Change-Id: I535efad65b2224337c133463da075953cc878c6c Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -295,7 +295,8 @@ void SharedMemory::setErrorString(const QString &function)
|
||||
m_error = QSharedMemory::OutOfResources;
|
||||
break;
|
||||
default:
|
||||
m_errorString = QStringLiteral("%1: unknown error %2").arg(function).arg(strerror(errno));
|
||||
m_errorString = QStringLiteral("%1: unknown error %2")
|
||||
.arg(function).arg(QString::fromLocal8Bit(strerror(errno)));
|
||||
m_error = QSharedMemory::UnknownError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer &
|
||||
}
|
||||
|
||||
if (propertyContainer.isDynamic() && propertyContainer.instanceId() == 0 && engine())
|
||||
rootContext()->setContextProperty(name, QVariant());
|
||||
rootContext()->setContextProperty(QString::fromUtf8(name), QVariant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,12 +839,14 @@ void NodeInstanceServer::setInstancePropertyBinding(const PropertyBindingContain
|
||||
bool stateBindingWasUpdated = activeStateInstance().updateStateBinding(instance, name, expression);
|
||||
if (!stateBindingWasUpdated) {
|
||||
if (bindingContainer.isDynamic())
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), name);
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(),
|
||||
QString::fromUtf8(name));
|
||||
instance.setPropertyBinding(name, expression);
|
||||
}
|
||||
} else {
|
||||
if (bindingContainer.isDynamic())
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), name);
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(),
|
||||
QString::fromUtf8(name));
|
||||
instance.setPropertyBinding(name, expression);
|
||||
}
|
||||
}
|
||||
@@ -871,17 +873,17 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer
|
||||
bool stateValueWasUpdated = activeStateInstance().updateStateVariant(instance, name, value);
|
||||
if (!stateValueWasUpdated) {
|
||||
if (valueContainer.isDynamic())
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), name);
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), QString::fromUtf8(name));
|
||||
instance.setPropertyVariant(name, value);
|
||||
}
|
||||
} else { //base state
|
||||
if (valueContainer.isDynamic())
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), name);
|
||||
Internal::QmlPrivateGate::createNewDynamicProperty(instance.internalInstance()->object(), engine(), QString::fromUtf8(name));
|
||||
instance.setPropertyVariant(name, value);
|
||||
}
|
||||
|
||||
if (valueContainer.isDynamic() && valueContainer.instanceId() == 0 && engine())
|
||||
rootContext()->setContextProperty(name, Internal::QmlPrivateGate::fixResourcePaths(value));
|
||||
rootContext()->setContextProperty(QString::fromUtf8(name), Internal::QmlPrivateGate::fixResourcePaths(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ static void removeObjectFromList(const QQmlProperty &property, QObject *objectTo
|
||||
|
||||
void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldParent, const PropertyName &oldParentProperty)
|
||||
{
|
||||
QQmlProperty property(oldParent, oldParentProperty, context());
|
||||
QQmlProperty property(oldParent, QString::fromUtf8(oldParentProperty), context());
|
||||
|
||||
if (!property.isValid())
|
||||
return;
|
||||
@@ -320,7 +320,7 @@ void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldPare
|
||||
|
||||
void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty)
|
||||
{
|
||||
QQmlProperty property(newParent, newParentProperty, context());
|
||||
QQmlProperty property(newParent, QString::fromUtf8(newParentProperty), context());
|
||||
|
||||
if (object)
|
||||
object->setParent(newParent);
|
||||
@@ -400,7 +400,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
|
||||
if (ignoredProperties().contains(name))
|
||||
return;
|
||||
|
||||
QQmlProperty property(object(), name, context());
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
|
||||
if (!property.isValid())
|
||||
return;
|
||||
@@ -482,7 +482,7 @@ void ObjectNodeInstance::resetProperty(const PropertyName &name)
|
||||
|
||||
void ObjectNodeInstance::refreshProperty(const PropertyName &name)
|
||||
{
|
||||
QQmlProperty property(object(), name, context());
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
|
||||
if (!property.isValid())
|
||||
return;
|
||||
@@ -523,7 +523,7 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
|
||||
if (QmlPrivateGate::isPropertyBlackListed(name))
|
||||
return QVariant();
|
||||
|
||||
QQmlProperty property(object(), name, context());
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
if (property.property().isEnumType()) {
|
||||
QVariant value = property.read();
|
||||
return property.property().enumerator().valueToKey(value.toInt());
|
||||
@@ -555,10 +555,10 @@ QString ObjectNodeInstance::instanceType(const PropertyName &name) const
|
||||
if (QmlPrivateGate::isPropertyBlackListed(name))
|
||||
return QLatin1String("undefined");
|
||||
|
||||
QQmlProperty property(object(), name, context());
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
if (!property.isValid())
|
||||
return QLatin1String("undefined");
|
||||
return property.propertyTypeName();
|
||||
return QString::fromUtf8(property.propertyTypeName());
|
||||
}
|
||||
|
||||
QList<ServerNodeInstance> ObjectNodeInstance::childItems() const
|
||||
|
||||
+1
-3
@@ -152,10 +152,8 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
|
||||
foreach (const InstancePropertyPair& property, changedPropertyList()) {
|
||||
const ServerNodeInstance instance = property.first;
|
||||
const QString propertyName = property.second;
|
||||
|
||||
if (instance.isValid()) {
|
||||
if (propertyName.contains("anchors"))
|
||||
if (property.second.contains("anchors"))
|
||||
informationChangedInstanceSet.insert(instance);
|
||||
|
||||
propertyChangedList.append(property);
|
||||
|
||||
@@ -276,10 +276,8 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
||||
|
||||
foreach (const InstancePropertyPair& property, changedPropertyList()) {
|
||||
const ServerNodeInstance instance = property.first;
|
||||
const QString propertyName = property.second;
|
||||
|
||||
if (instance.isValid()) {
|
||||
if (propertyName.contains("anchors"))
|
||||
if (property.second.contains("anchors"))
|
||||
informationChangedInstanceSet.insert(instance);
|
||||
|
||||
propertyChangedList.append(property);
|
||||
|
||||
@@ -690,7 +690,7 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name)
|
||||
if (name == "y")
|
||||
m_y = 0.0;
|
||||
|
||||
DesignerSupport::resetAnchor(quickItem(), name);
|
||||
DesignerSupport::resetAnchor(quickItem(), QString::fromUtf8(name));
|
||||
|
||||
if (name == "anchors.fill") {
|
||||
resetHorizontal();
|
||||
@@ -727,7 +727,7 @@ bool QuickItemNodeInstance::isAnchoredByChildren() const
|
||||
|
||||
bool QuickItemNodeInstance::hasAnchor(const PropertyName &name) const
|
||||
{
|
||||
return DesignerSupport::hasAnchor(quickItem(), name);
|
||||
return DesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name));
|
||||
}
|
||||
|
||||
static bool isValidAnchorName(const PropertyName &name)
|
||||
@@ -747,10 +747,11 @@ static bool isValidAnchorName(const PropertyName &name)
|
||||
|
||||
QPair<PropertyName, ServerNodeInstance> QuickItemNodeInstance::anchor(const PropertyName &name) const
|
||||
{
|
||||
if (!isValidAnchorName(name) || !DesignerSupport::hasAnchor(quickItem(), name))
|
||||
if (!isValidAnchorName(name) || !DesignerSupport::hasAnchor(quickItem(), QString::fromUtf8(name)))
|
||||
return ObjectNodeInstance::anchor(name);
|
||||
|
||||
QPair<QString, QObject*> nameObjectPair = DesignerSupport::anchorLineTarget(quickItem(), name, context());
|
||||
QPair<QString, QObject*> nameObjectPair =
|
||||
DesignerSupport::anchorLineTarget(quickItem(), QString::fromUtf8(name), context());
|
||||
|
||||
QObject *targetObject = nameObjectPair.second;
|
||||
PropertyName targetName = nameObjectPair.first.toUtf8();
|
||||
|
||||
@@ -205,7 +205,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
|
||||
if (object == 0)
|
||||
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QString("Component with path %1 could not be created.").arg(instanceContainer.componentPath()), instanceContainer.instanceId());
|
||||
} else {
|
||||
object = Internal::ObjectNodeInstance::createPrimitive(instanceContainer.type(), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
|
||||
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
|
||||
if (object == 0)
|
||||
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Item could not be created."), instanceContainer.instanceId());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH)
|
||||
|
||||
SOURCES += $$PWD/qml2puppetmain.cpp
|
||||
RESOURCES += $$PWD/../qmlpuppet.qrc
|
||||
DEFINES -= QT_RESTRICTED_CAST_FROM_ASCII
|
||||
|
||||
DISTFILES += Info.plist
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ QVariant fixResourcePaths(const QVariant &value)
|
||||
const QUrl url = value.toUrl();
|
||||
if (url.scheme() == QLatin1String("qrc")) {
|
||||
const QString path = QLatin1String("qrc:") + url.path();
|
||||
QString qrcSearchPath = qgetenv("QMLDESIGNER_RC_PATHS");
|
||||
QString qrcSearchPath = QString::fromLocal8Bit(qgetenv("QMLDESIGNER_RC_PATHS"));
|
||||
if (!qrcSearchPath.isEmpty()) {
|
||||
const QStringList searchPaths = qrcSearchPath.split(QLatin1Char(';'));
|
||||
foreach (const QString &qrcPath, searchPaths) {
|
||||
@@ -115,7 +115,7 @@ QVariant fixResourcePaths(const QVariant &value)
|
||||
if (value.type() == QVariant::String) {
|
||||
const QString str = value.toString();
|
||||
if (str.contains(QLatin1String("qrc:"))) {
|
||||
QString qrcSearchPath = qgetenv("QMLDESIGNER_RC_PATHS");
|
||||
QString qrcSearchPath = QString::fromLocal8Bit(qgetenv("QMLDESIGNER_RC_PATHS"));
|
||||
if (!qrcSearchPath.isEmpty()) {
|
||||
const QStringList searchPaths = qrcSearchPath.split(QLatin1Char(';'));
|
||||
foreach (const QString &qrcPath, searchPaths) {
|
||||
@@ -168,7 +168,7 @@ QVariant getResetValue(QObject *object, const PropertyName &propertyName)
|
||||
|
||||
static void setProperty(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QVariant &value)
|
||||
{
|
||||
QQmlProperty property(object, propertyName, context);
|
||||
QQmlProperty property(object, QString::fromUtf8(propertyName), context);
|
||||
property.write(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user