Fix QString-related warnings in quick designer support.
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Wed, 22 Jul 2015 07:00:30 +0000 (09:00 +0200)
committerTim Jenssen <tim.jenssen@theqtcompany.com>
Wed, 22 Jul 2015 18:44:30 +0000 (18:44 +0000)
designer/qquickdesignersupportmetainfo.cpp: In static member function 'static bool QQuickDesignerSupportMetaInfo::isSubclassOf(QObject*, const QByteArray&)':
designer/qquickdesignersupportmetainfo.cpp:50:51: warning: 'bool QString::operator==(const QByteArray&) const' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:1229) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp: In function 'void stopAnimation(QObject*)':
designer/qquickdesignersupportitems.cpp:62:35: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp:63:33: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp: In function 'void allSubObjects(QObject*, QObjectList&)':
designer/qquickdesignersupportitems.cpp:93:62: warning: 'bool operator!=(const char*, QLatin1String)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:1192) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp: In function 'QQmlType* getQmlType(const QString&, int, int)':
designer/qquickdesignersupportitems.cpp:166:78: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp: In static member function 'static QObject* QQuickDesignerSupportItems::createPrimitive(const QString&, int, int, QQmlContext*)':
designer/qquickdesignersupportitems.cpp:223:41: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp: In static member function 'static void QQuickDesignerSupportItems::disableTransition(QObject*)':
designer/qquickdesignersupportitems.cpp:295:42: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportitems.cpp:296:44: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportproperties.cpp: In static member function 'static QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::propertyNameListForWritableProperties(QObject*, const PropertyName&, QObjectList*)':
designer/qquickdesignersupportproperties.cpp:145:47: warning: 'bool QString::operator!=(const char*) const' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:1166) [-Wdeprecated-declarations]
designer/qquickdesignersupportstates.cpp: In static member function 'static bool QQuickDesignerSupportStates::isStateActive(QObject*, QQmlContext*)':
designer/qquickdesignersupportstates.cpp:50:50: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportstates.cpp: In static member function 'static void QQuickDesignerSupportStates::activateState(QObject*, QQmlContext*)':
designer/qquickdesignersupportstates.cpp:64:50: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignercustomobjectdata.cpp: In member function 'void QQuickDesignerCustomObjectData::populateResetHashes()':
designer/qquickdesignercustomobjectdata.cpp:146:93: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignercustomobjectdata.cpp: In member function 'void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext*, const PropertyName&)':
designer/qquickdesignercustomobjectdata.cpp:170:58: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignercustomobjectdata.cpp: In member function 'bool QQuickDesignerCustomObjectData::hasBindingForProperty(QQmlContext*, const PropertyName&, bool*) const':
designer/qquickdesignercustomobjectdata.cpp:227:58: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignercustomobjectdata.cpp: In member function 'void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext*, const PropertyName&, const QString&)':
designer/qquickdesignercustomobjectdata.cpp:244:58: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignercustomobjectdata.cpp:259:55: warning: 'QString::QString(const char*)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:653) [-Wdeprecated-declarations]
designer/qquickdesignersupportpropertychanges.cpp: In static member function 'static void QQuickDesignerSupportPropertyChanges::changeValue(QObject*, const PropertyName&, const QVariant&)':
designer/qquickdesignersupportpropertychanges.cpp:91:52: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]
designer/qquickdesignersupportpropertychanges.cpp: In static member function 'static void QQuickDesignerSupportPropertyChanges::changeExpression(QObject*, const PropertyName&, const QString&)':
designer/qquickdesignersupportpropertychanges.cpp:103:62: warning: 'QString::QString(const QByteArray&)' is deprecated (declared at /depot/fkleint/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:656) [-Wdeprecated-declarations]

Change-Id: Icdaec28b5bea23244303b082217660c38aefa40f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
src/quick/designer/qquickdesignercustomobjectdata.cpp
src/quick/designer/qquickdesignersupportitems.cpp
src/quick/designer/qquickdesignersupportmetainfo.cpp
src/quick/designer/qquickdesignersupportproperties.cpp
src/quick/designer/qquickdesignersupportpropertychanges.cpp
src/quick/designer/qquickdesignersupportstates.cpp

index cdd587b..1666ffb 100644 (file)
@@ -143,7 +143,7 @@ void QQuickDesignerCustomObjectData::populateResetHashes()
             QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object());
 
     Q_FOREACH (const QQuickDesignerSupport::PropertyName &propertyName, propertyNameList) {
-        QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object()));
+        QQmlProperty property(object(), QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object()));
 
         QQmlAbstractBinding::Ptr binding = QQmlAbstractBinding::Ptr(QQmlPropertyPrivate::binding(property));
 
@@ -167,7 +167,7 @@ QVariant QQuickDesignerCustomObjectData::getResetValue(const QQuickDesignerSuppo
 
 void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName)
 {
-    QQmlProperty property(object(), propertyName, context);
+    QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
 
     if (!property.isValid())
         return;
@@ -224,7 +224,7 @@ bool QQuickDesignerCustomObjectData::hasBindingForProperty(QQmlContext *context,
     if (QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName))
         return false;
 
-    QQmlProperty property(object(), propertyName, context);
+    QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
 
     bool hasBinding = QQmlPropertyPrivate::binding(property);
 
@@ -241,7 +241,7 @@ void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext *context,
                                                   const QQuickDesignerSupport::PropertyName &propertyName,
                                                   const QString &expression)
 {
-    QQmlProperty property(object(), propertyName, context);
+    QQmlProperty property(object(), QString::fromUtf8(propertyName), context);
 
     if (!property.isValid())
         return;
@@ -256,7 +256,7 @@ void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext *context,
         binding->update();
         if (binding->hasError()) {
             if (property.property().userType() == QVariant::String)
-                property.write(QVariant(QString("#%1#").arg(expression)));
+                property.write(QVariant(QLatin1Char('#') + expression + QLatin1Char('#')));
         }
 
     } else {
index d5e848b..4f23fe6 100644 (file)
@@ -59,8 +59,8 @@ static void stopAnimation(QObject *object)
     QQuickAbstractAnimation *animation = qobject_cast<QQuickAbstractAnimation*>(object);
     QQmlTimer *timer = qobject_cast<QQmlTimer*>(object);
     if (transition) {
-       transition->setFromState("");
-       transition->setToState("");
+       transition->setFromState(QString());
+       transition->setToState(QString());
     } else if (animation) {
 //        QQuickScriptAction *scriptAimation = qobject_cast<QQuickScriptAction*>(animation);
 //        if (scriptAimation) FIXME
@@ -90,7 +90,7 @@ static void allSubObjects(QObject *object, QObjectList &objectList)
         if (metaProperty.isReadable()
                 && metaProperty.isWritable()
                 && QQmlMetaType::isQObject(metaProperty.userType())) {
-            if (metaProperty.name() != QLatin1String("parent")) {
+            if (qstrcmp(metaProperty.name(), "parent")) {
                 QObject *propertyObject = QQmlMetaType::toQObject(metaProperty.read(object));
                 allSubObjects(propertyObject, objectList);
             }
@@ -163,7 +163,7 @@ static bool isWindow(QObject *object) {
 
 static QQmlType *getQmlType(const QString &typeName, int majorNumber, int minorNumber)
 {
-     return QQmlMetaType::qmlType(typeName.toUtf8(), majorNumber, minorNumber);
+     return QQmlMetaType::qmlType(typeName, majorNumber, minorNumber);
 }
 
 static bool isCrashingType(QQmlType *type)
@@ -220,7 +220,7 @@ QObject *QQuickDesignerSupportItems::createPrimitive(const QString &typeName, in
 
     if (!object) {
         qWarning() << "QuickDesigner: Cannot create an object of type"
-                   << QString("%1 %2,%3").arg(typeName).arg(majorNumber).arg(minorNumber)
+                   << QString::fromLatin1("%1 %2,%3").arg(typeName).arg(majorNumber).arg(minorNumber)
                    << "- type isn't known to declarative meta type system";
     }
 
@@ -292,8 +292,9 @@ void QQuickDesignerSupportItems::disableTransition(QObject *object)
 {
     QQuickTransition *transition = qobject_cast<QQuickTransition*>(object);
     Q_ASSERT(transition);
-    transition->setToState("invalidState");
-    transition->setFromState("invalidState");
+    const QString invalidState = QLatin1String("invalidState");
+    transition->setToState(invalidState);
+    transition->setFromState(invalidState);
 }
 
 void QQuickDesignerSupportItems::disableBehaivour(QObject *object)
index 5044130..c6c7ed3 100644 (file)
@@ -47,7 +47,7 @@ bool QQuickDesignerSupportMetaInfo::isSubclassOf(QObject *object, const QByteArr
 
     while (metaObject) {
          QQmlType *qmlType =  QQmlMetaType::qmlType(metaObject);
-         if (qmlType && qmlType->qmlTypeName() == superTypeName) // ignore version numbers
+         if (qmlType && qmlType->qmlTypeName() == QLatin1String(superTypeName)) // ignore version numbers
              return true;
 
          if (metaObject->className() == superTypeName)
index e471b0e..300ad6d 100644 (file)
@@ -142,7 +142,7 @@ QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::propert
         QMetaProperty metaProperty = metaObject->property(index);
         QQmlProperty declarativeProperty(object, QLatin1String(metaProperty.name()));
         if (declarativeProperty.isValid() && !declarativeProperty.isWritable() && declarativeProperty.propertyTypeCategory() == QQmlProperty::Object) {
-            if (declarativeProperty.name() != "parent") {
+            if (declarativeProperty.name() != QLatin1String("parent")) {
                 QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read());
                 if (childObject)
                     propertyNameList.append(propertyNameListForWritableProperties(childObject,
index 997582a..b8706fc 100644 (file)
@@ -88,7 +88,7 @@ void QQuickDesignerSupportPropertyChanges::changeValue(QObject *propertyChanges,
     if (!propertyChange)
         return;
 
-    propertyChange->changeValue(propertyName, value);
+    propertyChange->changeValue(QString::fromUtf8(propertyName), value);
 }
 
 void QQuickDesignerSupportPropertyChanges::changeExpression(QObject *propertyChanges,
@@ -100,7 +100,7 @@ void QQuickDesignerSupportPropertyChanges::changeExpression(QObject *propertyCha
     if (!propertyChange)
         return;
 
-    propertyChange->changeExpression(propertyName, expression);
+    propertyChange->changeExpression(QString::fromUtf8(propertyName), expression);
 }
 
 QObject *QQuickDesignerSupportPropertyChanges::stateObject(QObject *propertyChanges)
index 2b4fc97..b75ec71 100644 (file)
@@ -47,7 +47,7 @@ bool QQuickDesignerSupportStates::isStateActive(QObject *object, QQmlContext *co
 
     QQuickStateGroup *stateGroup = stateObject->stateGroup();
 
-    QQmlProperty property(object, "name", context);
+    QQmlProperty property(object, QLatin1String("name"), context);
 
     return stateObject && stateGroup && stateGroup->state() == property.read();
 }
@@ -61,7 +61,7 @@ void QQuickDesignerSupportStates::activateState(QObject *object, QQmlContext *co
 
     QQuickStateGroup *stateGroup = stateObject->stateGroup();
 
-    QQmlProperty property(object, "name", context);
+    QQmlProperty property(object, QLatin1String("name"), context);
 
     stateGroup->setState(property.read().toString());
 }