From dc66752f24442a0bb219a9a4810b47ba4ece3d5c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Oct 2009 16:17:55 +1000 Subject: Fixes for Symbian. --- src/declarative/fx/qfxgridview.h | 1 + src/declarative/fx/qfxitem.cpp | 1 + src/declarative/fx/qfxlistview.h | 1 + src/declarative/fx/qfxpathview.h | 2 +- src/declarative/fx/qfxvisualitemmodel.h | 1 + src/declarative/fx/qfxwebview.h | 1 + src/declarative/qml/qml.h | 14 ++++++++++++++ src/declarative/qml/qmlcomponent.h | 1 + src/declarative/qml/qmlexpression.cpp | 8 +++++++- src/declarative/qml/qmlprivate.h | 27 +++++++++++++++++++++------ src/declarative/util/qmlpackage.h | 1 + src/declarative/widgets/graphicslayouts.h | 2 ++ 12 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 7f30f03..1c0a700 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -150,6 +150,7 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QFxGridView) +QML_DECLARE_TYPEINFO(QFxGridView, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 903fad7..bd94b8c 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2860,6 +2860,7 @@ int QFxItemPrivate::restart(QTime &t) QT_END_NAMESPACE QML_DECLARE_TYPE(QFxKeysAttached) +QML_DECLARE_TYPEINFO(QFxKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Keys,QFxKeysAttached) QML_DECLARE_TYPE(QFxKeyNavigationAttached) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,KeyNavigation,QFxKeyNavigationAttached) diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 5a83604..1ff0e27 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -174,6 +174,7 @@ private Q_SLOTS: QT_END_NAMESPACE +QML_DECLARE_TYPEINFO(QFxListView, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QFxListView) QT_END_HEADER diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index 3ee352a..c8c0ac0 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -132,7 +132,7 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QFxPathView) - +QML_DECLARE_TYPEINFO(QFxPathView, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER #endif // QFXPATHVIEW_H diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index f519a9e..5b613d8 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -192,6 +192,7 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QFxVisualModel) QML_DECLARE_TYPE(QFxVisualItemModel) +QML_DECLARE_TYPEINFO(QFxVisualItemModel, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QFxVisualDataModel) QT_END_HEADER diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index f136e2d..a31b2b0 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -243,6 +243,7 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QFxWebView) +QML_DECLARE_TYPEINFO(QFxWebView, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QAction) QT_END_HEADER 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 \ +{ \ +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 +//struct qml_hasAttached { static bool const value = false; }; + +template +class QmlTypeInfo +{ +public: + enum { + hasAttachedProperties = 0 + }; +}; + + namespace QmlPrivate { class ListInterface @@ -101,11 +114,7 @@ namespace QmlPrivate template struct StaticCastSelectorClass { -#ifndef Q_OS_SYMBIAN static inline int cast() { return (int)((intptr_t)static_cast((From *)0x10000000)) - 0x10000000; } -#else - static inline int cast() { return (int)(static_cast((From *)0x10000000)) - 0x10000000; } -#endif }; template @@ -135,6 +144,12 @@ namespace QmlPrivate static bool const value = false; } }; +#elif defined(Q_OS_SYMBIAN) + template + struct has_attachedPropertiesMember + { + static bool const value = QmlTypeInfo::hasAttachedProperties; + }; #else template class has_attachedPropertiesMember @@ -147,8 +162,8 @@ namespace QmlPrivate template static yes_type test(Selector*); - template - static no_type test(...); + template + static no_type test(...); public: static bool const value = sizeof(test(0)) == sizeof(yes_type); diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h index 9f7a623..7cceaa7 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage.h @@ -81,6 +81,7 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QmlPackage) +QML_DECLARE_TYPEINFO(QmlPackage, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts.h index 863f846..45f1439 100644 --- a/src/declarative/widgets/graphicslayouts.h +++ b/src/declarative/widgets/graphicslayouts.h @@ -184,7 +184,9 @@ QML_DECLARE_INTERFACE(QGraphicsLayoutItem) QML_DECLARE_INTERFACE(QGraphicsLayout) QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject) QML_DECLARE_TYPE(QGraphicsLinearLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QGraphicsGridLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER -- cgit v0.12