summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qml.h14
-rw-r--r--src/declarative/qml/qmlcomponent.h1
-rw-r--r--src/declarative/qml/qmlexpression.cpp8
-rw-r--r--src/declarative/qml/qmlprivate.h27
4 files changed, 43 insertions, 7 deletions
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index c437ef1..818b4e7 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -72,6 +72,20 @@ QT_MODULE(Declarative)
#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \
QML_DECLARE_TYPE_HASMETATYPE(INTERFACE)
+enum { /* TYPEINFO flags */
+ QML_HAS_ATTACHED_PROPERTIES = 0x01,
+};
+
+#define QML_DECLARE_TYPEINFO(TYPE, FLAGS) \
+template <> \
+class QmlTypeInfo<TYPE > \
+{ \
+public: \
+ enum { \
+ hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \
+ }; \
+};
+
QT_BEGIN_NAMESPACE
#if defined(Q_OS_SYMBIAN)
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index dcf9347..7470f31 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -116,6 +116,7 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QmlComponent::Status)
QML_DECLARE_TYPE(QmlComponent)
+QML_DECLARE_TYPEINFO(QmlComponent, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 76ca2c1..d73d51a 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -109,15 +109,21 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
QmlEngine *engine = ctxt->engine();
QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+#ifndef Q_OS_SYMBIAN //XXX Why doesn't this work?
if (!dd->programs.at(progIdx)) {
- dd->programs[progIdx] =
+ dd->programs[progIdx] =
new QScriptProgram(scriptEngine->compile(data->expression, data->fileName, data->line));
}
+#endif
QScriptContext *scriptContext = scriptEngine->pushCleanContext();
scriptContext->pushScope(ep->contextClass->newContext(ctxt, me));
+#ifndef Q_OS_SYMBIAN
data->expressionFunction = scriptEngine->evaluate(*dd->programs[progIdx]);
+#else
+ data->expressionFunction = scriptEngine->evaluate(data->expression);
+#endif
data->expressionFunctionValid = true;
scriptEngine->popContext();
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index e821759..3e1a7e0 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -56,6 +56,19 @@ QT_MODULE(Declarative)
typedef QObject *(*QmlAttachedPropertiesFunc)(QObject *);
+//template<typename T>
+//struct qml_hasAttached { static bool const value = false; };
+
+template <typename TYPE>
+class QmlTypeInfo
+{
+public:
+ enum {
+ hasAttachedProperties = 0
+ };
+};
+
+
namespace QmlPrivate
{
class ListInterface
@@ -101,11 +114,7 @@ namespace QmlPrivate
template<class From, class To>
struct StaticCastSelectorClass<From, To, sizeof(int)>
{
-#ifndef Q_OS_SYMBIAN
static inline int cast() { return (int)((intptr_t)static_cast<To *>((From *)0x10000000)) - 0x10000000; }
-#else
- static inline int cast() { return (int)(static_cast<To *>((From *)0x10000000)) - 0x10000000; }
-#endif
};
template<class From, class To>
@@ -135,6 +144,12 @@ namespace QmlPrivate
static bool const value = false;
}
};
+#elif defined(Q_OS_SYMBIAN)
+ template <typename T>
+ struct has_attachedPropertiesMember
+ {
+ static bool const value = QmlTypeInfo<T>::hasAttachedProperties;
+ };
#else
template <typename T>
class has_attachedPropertiesMember
@@ -147,8 +162,8 @@ namespace QmlPrivate
template <typename S>
static yes_type test(Selector<sizeof(&S::qmlAttachedProperties)>*);
- template <typename S>
- static no_type test(...);
+ template <typename S>
+ static no_type test(...);
public:
static bool const value = sizeof(test<T>(0)) == sizeof(yes_type);