summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2013-05-07 09:45:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-13 08:41:33 +0200
commit8c02d79c5b7d769c848c0441c4e9a6f1e0a41912 (patch)
treefb2cbcba71774810cebabdabbb799368b43aa156
parent100cfb7c71b5dfb507d7b470bf60df49c36d9e40 (diff)
Move exports conflicting with QtQml into namespace
Move exported qml* symbols that conflict with QtQml into an - automatically imported - namespace. This ensures apps can link against both QtDeclarative and QtQml. To keep the BC promise the old symbols are still exported. Task-number: QTBUG-29584 Change-Id: Icf4e586fee51d2bd82125398e2bb96d6dd355cc5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
-rw-r--r--src/declarative/qml/qdeclarative.h17
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp40
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp26
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h25
4 files changed, 94 insertions, 14 deletions
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
index dd08105e..95cef935 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -404,11 +404,18 @@ inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, i
class QDeclarativeContext;
class QDeclarativeEngine;
-Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
-Q_DECLARATIVE_EXPORT QDeclarativeContext *qmlContext(const QObject *);
-Q_DECLARATIVE_EXPORT QDeclarativeEngine *qmlEngine(const QObject *);
-Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
-Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create);
+
+namespace QtDeclarative {
+ // declared in namespace to avoid symbol conflicts with QtQml
+ Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
+ Q_DECLARATIVE_EXPORT QDeclarativeContext *qmlContext(const QObject *);
+ Q_DECLARATIVE_EXPORT QDeclarativeEngine *qmlEngine(const QObject *);
+ Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *,
+ bool create = true);
+ Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *,
+ const QMetaObject *, bool create);
+}
+using namespace QtDeclarative;
template<typename T>
QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 691fb713..fe33cc3d 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1020,6 +1020,8 @@ QDeclarativeEngine::ObjectOwnership QDeclarativeEngine::objectOwnership(QObject
return ddata->indestructible?CppOwnership:JavaScriptOwnership;
}
+namespace QtDeclarative {
+
void qmlExecuteDeferred(QObject *object)
{
QDeclarativeData *data = QDeclarativeData::get(object);
@@ -1088,9 +1090,45 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
if (*idCache == -1 || !object)
return 0;
- return qmlAttachedPropertiesObjectById(*idCache, object, create);
+ return QtDeclarative::qmlAttachedPropertiesObjectById(*idCache, object, create);
+}
+
+} // namespace QtDeclarative
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with 5.0
+
+Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *obj)
+{
+ QtDeclarative::qmlExecuteDeferred(obj);
+}
+
+Q_DECLARATIVE_EXPORT QDeclarativeContext *qmlContext(const QObject *obj)
+{
+ return QtDeclarative::qmlContext(obj);
+}
+
+Q_DECLARATIVE_EXPORT QDeclarativeEngine *qmlEngine(const QObject *obj)
+{
+ return QtDeclarative::qmlEngine(obj);
+}
+
+Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int id, const QObject * obj,
+ bool create)
+{
+ return QtDeclarative::qmlAttachedPropertiesObjectById(id, obj, create);
}
+Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
+ const QMetaObject *attachedMetaObject,
+ bool create)
+{
+ return QtDeclarative::qmlAttachedPropertiesObject(idCache, object, attachedMetaObject, create);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
+
QDeclarativeDebuggingEnabler::QDeclarativeDebuggingEnabler()
{
#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index 30c89d8e..960cc352 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -152,6 +152,8 @@ QDeclarativeInfo::~QDeclarativeInfo()
}
}
+namespace QtDeclarative {
+
QDeclarativeInfo qmlInfo(const QObject *me)
{
QDeclarativeInfoPrivate *d = new QDeclarativeInfoPrivate;
@@ -175,5 +177,29 @@ QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDeclarativeError> &erro
return QDeclarativeInfo(d);
}
+} // namespace QtDeclarative
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with 5.0
+
+Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me)
+{
+ return QtDeclarative::qmlInfo(me);
+}
+
+Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me,
+ const QDeclarativeError &error)
+{
+ return QtDeclarative::qmlInfo(me, error);
+}
+
+Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me,
+ const QList<QDeclarativeError> &errors)
+{
+ return QtDeclarative::qmlInfo(me, errors);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
index 7b23a341..2db5d960 100644
--- a/src/declarative/qml/qdeclarativeinfo.h
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -50,6 +50,18 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QDeclarativeInfo;
+
+namespace QtDeclarative {
+ // declared in namespace to avoid symbol conflicts with QtQml
+ Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me);
+ Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me,
+ const QDeclarativeError &error);
+ Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me,
+ const QList<QDeclarativeError> &errors);
+}
+using namespace QtDeclarative;
+
class QDeclarativeInfoPrivate;
class Q_DECLARATIVE_EXPORT QDeclarativeInfo : public QDebug
{
@@ -83,18 +95,15 @@ public:
#endif
private:
- friend Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me);
- friend Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me, const QDeclarativeError &error);
- friend Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDeclarativeError> &errors);
-
+ friend Q_DECLARATIVE_EXPORT QDeclarativeInfo QtDeclarative::qmlInfo(const QObject *me);
+ friend Q_DECLARATIVE_EXPORT QDeclarativeInfo QtDeclarative::qmlInfo(const QObject *me,
+ const QDeclarativeError &error);
+ friend Q_DECLARATIVE_EXPORT QDeclarativeInfo QtDeclarative::qmlInfo(const QObject *me,
+ const QList<QDeclarativeError> &errors);
QDeclarativeInfo(QDeclarativeInfoPrivate *);
QDeclarativeInfoPrivate *d;
};
-Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me);
-Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me, const QDeclarativeError &error);
-Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDeclarativeError> &errors);
-
QT_END_NAMESPACE
#endif // QDECLARATIVEINFO_H