summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-04-20 16:39:21 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-04-24 07:52:39 (GMT)
commitfa842094e4d596ed8c7f9839df179aa48a5a9c63 (patch)
tree366ceeb4589e1d118a77241c55d8619a4870d4aa /src/declarative
parent98f3c22d57ce9b4a2dff8e8eef1c786b89426645 (diff)
downloadQt-fa842094e4d596ed8c7f9839df179aa48a5a9c63.zip
Qt-fa842094e4d596ed8c7f9839df179aa48a5a9c63.tar.gz
Qt-fa842094e4d596ed8c7f9839df179aa48a5a9c63.tar.bz2
parse function declarations in the object declaration and generate script properties. Makes the slider work.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp2
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp21
2 files changed, 21 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index dd42581..e1a88bb 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -747,8 +747,6 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
if(isBinding(script))
COMPILE_EXCEPTION("Cannot assign binding to signal property");
- qDebug() << "and here we go...";
-
int idx = output->indexForString(script);
int pr = output->indexForByteArray(prop->name);
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index ddd473a..a141fa4 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -77,6 +77,7 @@ protected:
virtual bool visit(AST::UiScriptBinding *node);
virtual bool visit(AST::UiArrayBinding *node);
+ virtual bool visit(AST::UiSourceElement *node);
void accept(AST::Node *node);
@@ -423,6 +424,26 @@ bool ProcessAST::visit(AST::UiArrayBinding *node)
return false;
}
+bool ProcessAST::visit(AST::UiSourceElement *node)
+{
+ QString source;
+ QTextStream out(&source);
+ PrettyPretty pp(out);
+
+ pp(node->sourceElement);
+
+ Object *obj = defineObjectBinding(-1, // ### line
+ 0,
+ QLatin1String("Script"));
+
+ Value *value = new Value;
+ value->primitive = source;
+ value->line = -1; // ### fix me
+ obj->getDefaultProperty()->addValue(value);
+
+ return false;
+}
+
} // end of anonymous namespace