summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-22 03:47:36 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-22 03:47:36 (GMT)
commit8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8 (patch)
treee4306daf00a4deb05e1a4ad447c9e3327494aebc /src/declarative/qml
parent6ddbc147cadc4d450bb8e20cedf1b99e0fcbf894 (diff)
parent2575eac4c26ad92dde95959a82f576edc3e76e1d (diff)
downloadQt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.zip
Qt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.tar.gz
Qt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp4
-rw-r--r--src/declarative/qml/qmlcontext.cpp2
-rw-r--r--src/declarative/qml/qmlcustomparser.cpp1
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp16
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp31
-rw-r--r--src/declarative/qml/qmlvme.cpp3
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp9
7 files changed, 44 insertions, 22 deletions
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index e1124a6..0da1a92 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -315,7 +315,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
continue;
}
- QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url));
+ QUrl url = engine->componentUrl(QUrl(QLatin1String(type + ".qml")), QUrl(unit->url));
QmlCompositeTypeData *urlUnit = components.value(url.toString());
if (!urlUnit) {
@@ -335,7 +335,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
{
QmlError error;
error.setUrl(unit->url);
- error.setDescription("Type " + type + " unavailable");
+ error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(type)));
unit->errors << error;
}
if (urlUnit->errorType != QmlCompositeTypeData::AccessError)
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index ea72ebf..e5016f2 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -73,8 +73,6 @@ void QmlContextPrivate::dump(int depth)
void QmlContextPrivate::destroyed(QObject *obj)
{
- Q_Q(QmlContext);
-
defaultObjects.removeAll(obj);
QVariant variantObject = QVariant::fromValue(obj);
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp
index a60f783..2e8c8f6 100644
--- a/src/declarative/qml/qmlcustomparser.cpp
+++ b/src/declarative/qml/qmlcustomparser.cpp
@@ -224,6 +224,7 @@ QList<QVariant> QmlCustomParserProperty::assignedValues() const
QByteArray QmlCustomParser::compile(const QList<QmlCustomParserProperty> &, bool *ok)
{
+ Q_UNUSED(ok);
return QByteArray();
}
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index e3e9ff5..3aa4f1d 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -730,19 +730,19 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
switch(t) {
case QVariant::Double:
{
- qreal r;
+ double d;
bool found = true;
if (vt == QVariant::Int) {
- r = value.toInt();
+ d = value.toInt();
} else if (vt == QVariant::UInt) {
- r = value.toUInt();
+ d = value.toUInt();
} else {
found = false;
}
if (found) {
void *a[1];
- a[0] = &r;
+ a[0] = &d;
QMetaObject::metacall(object,
QMetaObject::WriteProperty,
coreIdx, a);
@@ -906,19 +906,19 @@ void QmlMetaProperty::write(const QVariant &value) const
switch(t) {
case QVariant::Double:
{
- qreal r;
+ double dd;
bool found = true;
if (vt == QVariant::Int) {
- r = value.toInt();
+ dd = value.toInt();
} else if (vt == QVariant::UInt) {
- r = value.toUInt();
+ dd = value.toUInt();
} else {
found = false;
}
if (found) {
void *a[1];
- a[0] = &r;
+ a[0] = &dd;
QMetaObject::metacall(object(),
QMetaObject::WriteProperty,
d->coreIdx, a);
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index ead7ee5..5b3564f 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -10,8 +10,11 @@
#include "parser/javascriptast_p.h"
#include <QStack>
+#include <QCoreApplication>
#include <QtDebug>
+#include <qfxperf.h>
+
QT_BEGIN_NAMESPACE
using namespace JavaScript;
@@ -203,7 +206,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
LocationSpan location,
AST::UiObjectInitializer *initializer)
{
- bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.'));
+ int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.'));
+ bool isType = !objectType.isEmpty() &&
+ (objectType.at(0).isUpper() ||
+ (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper()));
int propertyCount = 0;
for (; propertyName; propertyName = propertyName->next){
@@ -216,7 +222,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if(propertyCount || !currentObject()) {
QmlError error;
- error.setDescription("Expected type name");
+ error.setDescription(QCoreApplication::translate("QmlParser","Expected type name"));
error.setLine(typeLocation.startLine);
error.setColumn(typeLocation.startColumn);
_parser->_errors << error;
@@ -234,15 +240,21 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
return 0;
} else {
-
// Class
- const int typeId = _parser->findOrCreateTypeId(objectType);
+
+ QString resolvableObjectType = objectType;
+ if (lastTypeDot >= 0)
+ resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/'));
+ const int typeId = _parser->findOrCreateTypeId(resolvableObjectType);
Object *obj = new Object;
obj->type = typeId;
- _scope.append(objectType);
+
+ // XXX this doesn't do anything (_scope never builds up)
+ _scope.append(resolvableObjectType);
obj->typeName = qualifiedNameId().toLatin1();
_scope.removeLast();
+
obj->location = location;
if (propertyCount) {
@@ -416,7 +428,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
if(!typeFound) {
QmlError error;
- error.setDescription("Expected property type");
+ error.setDescription(QCoreApplication::translate("QmlParser","Expected property type"));
error.setLine(node->typeToken.startLine);
error.setColumn(node->typeToken.startColumn);
_parser->_errors << error;
@@ -562,7 +574,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
if(funDecl->formals) {
QmlError error;
- error.setDescription("Slot declarations must be parameterless");
+ error.setDescription(QCoreApplication::translate("QmlParser","Slot declarations must be parameterless"));
error.setLine(funDecl->lparenToken.startLine);
error.setColumn(funDecl->lparenToken.startColumn);
_parser->_errors << error;
@@ -576,7 +588,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
obj->dynamicSlots << slot;
} else {
QmlError error;
- error.setDescription("JavaScript declaration outside Script element");
+ error.setDescription(QCoreApplication::translate("QmlParser","JavaScript declaration outside Script element"));
error.setLine(node->firstSourceLocation().startLine);
error.setColumn(node->firstSourceLocation().startColumn);
_parser->_errors << error;
@@ -621,6 +633,9 @@ QmlScriptParser::~QmlScriptParser()
bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url)
{
+#ifdef Q_ENABLE_PERFORMANCE_LOG
+ QFxPerfTimer<QFxPerf::QmlParsing> pt;
+#endif
const QString fileName = url.toString();
QTextStream stream(data, QIODevice::ReadOnly);
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 1552cb5..a5cc649 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -1017,7 +1017,8 @@ void QmlVME::runStoreInstruction(QStack<QObject *> &stack,
QFxCompilerTimer<QFxCompiler::InstrStoreReal> cc;
#endif
QObject *target = stack.top();
- qreal r = instr.storeReal.value;
+ //### moc treats qreal properties as having type double
+ double r = static_cast<double>(instr.storeReal.value);
void *a[1];
a[0] = &r;
QMetaObject::metacall(target, QMetaObject::WriteProperty,
diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp
index e0a668a..37a6678 100644
--- a/src/declarative/qml/script/qmlbasicscript.cpp
+++ b/src/declarative/qml/script/qmlbasicscript.cpp
@@ -139,9 +139,16 @@ static QVariant fetch_value(QObject *o, int idx, int type)
}
break;
case 135:
+ {
+ float val;
+ void *args[] = { &val, 0 };
+ QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args);
+ return QVariant(val);
+ }
+ break;
case QVariant::Double:
{
- qreal val;
+ double val;
void *args[] = { &val, 0 };
QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args);
return QVariant(val);