qml: Pass non-trivially-copyable types by const-ref
authorSérgio Martins <sergio.martins@kdab.com>
Sun, 19 Jul 2015 18:25:25 +0000 (19:25 +0100)
committerSimon Hausmann <simon.hausmann@theqtcompany.com>
Mon, 20 Jul 2015 19:30:29 +0000 (19:30 +0000)
Change-Id: Id3d960ee8236a4c6f4bb4e0add1f88dfa32d3592
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
src/qml/qml/qqmlimport.cpp
src/qml/qml/qqmlmetatype.cpp
src/qml/qml/qqmlmetatype_p.h
src/qml/types/qqmldelegatemodel.cpp
src/qml/types/qqmldelegatemodel_p.h
src/qml/types/qqmldelegatemodel_p_p.h
src/qml/types/qqmlobjectmodel_p.h

index 87ee807..cf509a9 100644 (file)
@@ -385,7 +385,7 @@ void QQmlImports::populateCache(QQmlTypeNameCache *cache) const
 // We need to exclude the entry for the current baseUrl. This can happen for example
 // when handling qmldir files on the remote dir case and the current type is marked as
 // singleton.
-bool excludeBaseUrl(const QString &importUrl, const QString &fileName, const QString baseUrl)
+bool excludeBaseUrl(const QString &importUrl, const QString &fileName, const QString &baseUrl)
 {
     if (importUrl.isEmpty())
         return false;
@@ -401,7 +401,7 @@ bool excludeBaseUrl(const QString &importUrl, const QString &fileName, const QSt
     return true;
 }
 
-void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports::CompositeSingletonReference> &resultList, QUrl baseUrl)
+void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports::CompositeSingletonReference> &resultList, const QUrl &baseUrl)
 {
     typedef QQmlDirComponents::const_iterator ConstIterator;
 
index 55df65e..4162980 100644 (file)
@@ -255,7 +255,7 @@ QObject *QQmlType::SingletonInstanceInfo::qobjectApi(QQmlEngine *e) const
     return qobjectApis.value(e);
 }
 
-void QQmlType::SingletonInstanceInfo::setScriptApi(QQmlEngine *e, QJSValue v)
+void QQmlType::SingletonInstanceInfo::setScriptApi(QQmlEngine *e, const QJSValue &v)
 {
     scriptApis.insert(e, v);
 }
index e5ac20d..61a6567 100644 (file)
@@ -191,7 +191,7 @@ public:
 
         void setQObjectApi(QQmlEngine *, QObject *);
         QObject *qobjectApi(QQmlEngine *) const;
-        void setScriptApi(QQmlEngine *, QJSValue);
+        void setScriptApi(QQmlEngine *, const QJSValue &);
         QJSValue scriptApi(QQmlEngine *) const;
 
         void init(QQmlEngine *);
index 630c7e7..bc70e68 100644 (file)
@@ -1057,7 +1057,7 @@ int QQmlDelegateModel::indexOf(QObject *item, QObject *) const
     return -1;
 }
 
-void QQmlDelegateModel::setWatchedRoles(QList<QByteArray> roles)
+void QQmlDelegateModel::setWatchedRoles(const QList<QByteArray> &roles)
 {
     Q_D(QQmlDelegateModel);
     d->m_adaptorModel.replaceWatchedRoles(d->m_watchedRoles, roles);
@@ -3185,7 +3185,7 @@ QString QQmlPartsModel::stringValue(int index, const QString &role)
     return QQmlDelegateModelPrivate::get(m_model)->stringValue(m_compositorGroup, index, role);
 }
 
-void QQmlPartsModel::setWatchedRoles(QList<QByteArray> roles)
+void QQmlPartsModel::setWatchedRoles(const QList<QByteArray> &roles)
 {
     QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(m_model);
     model->m_adaptorModel.replaceWatchedRoles(m_watchedRoles, roles);
index 5ebffd5..e222fad 100644 (file)
@@ -96,7 +96,7 @@ public:
     ReleaseFlags release(QObject *object);
     void cancel(int index);
     virtual QString stringValue(int index, const QString &role);
-    virtual void setWatchedRoles(QList<QByteArray> roles);
+    virtual void setWatchedRoles(const QList<QByteArray> &roles);
 
     int indexOf(QObject *object, QObject *objectContext) const;
 
index dc289eb..5c28021 100644 (file)
@@ -356,7 +356,7 @@ public:
     ReleaseFlags release(QObject *item);
     QString stringValue(int index, const QString &role);
     QList<QByteArray> watchedRoles() const { return m_watchedRoles; }
-    void setWatchedRoles(QList<QByteArray> roles);
+    void setWatchedRoles(const QList<QByteArray> &roles);
 
     int indexOf(QObject *item, QObject *objectContext) const;
 
index 9f56ad7..f6ab2a1 100644 (file)
@@ -61,7 +61,7 @@ public:
     virtual ReleaseFlags release(QObject *object) = 0;
     virtual void cancel(int) {}
     virtual QString stringValue(int, const QString &) = 0;
-    virtual void setWatchedRoles(QList<QByteArray> roles) = 0;
+    virtual void setWatchedRoles(const QList<QByteArray> &roles) = 0;
 
     virtual int indexOf(QObject *object, QObject *objectContext) const = 0;
 
@@ -99,7 +99,7 @@ public:
     virtual QObject *object(int index, bool asynchronous=false);
     virtual ReleaseFlags release(QObject *object);
     virtual QString stringValue(int index, const QString &role);
-    virtual void setWatchedRoles(QList<QByteArray>) {}
+    virtual void setWatchedRoles(const QList<QByteArray> &) {}
 
     virtual int indexOf(QObject *object, QObject *objectContext) const;