summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecustomparser.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-17 06:26:20 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-17 06:26:20 (GMT)
commit1c4bb7a951ae50983a38acaf633eab272d3603b9 (patch)
tree09adb6ee05b253858447192bac9991554e3675e6 /src/declarative/qml/qdeclarativecustomparser.cpp
parent0a52765f1c7fbd7d5286bcaab32cff35feb89a95 (diff)
downloadQt-1c4bb7a951ae50983a38acaf633eab272d3603b9.zip
Qt-1c4bb7a951ae50983a38acaf633eab272d3603b9.tar.gz
Qt-1c4bb7a951ae50983a38acaf633eab272d3603b9.tar.bz2
Allow enum constants as list element properties.
Task-number: QTBUG-5974
Diffstat (limited to 'src/declarative/qml/qdeclarativecustomparser.cpp')
-rw-r--r--src/declarative/qml/qdeclarativecustomparser.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp
index 67f0963..a3a511c 100644
--- a/src/declarative/qml/qdeclarativecustomparser.cpp
+++ b/src/declarative/qml/qdeclarativecustomparser.cpp
@@ -43,6 +43,7 @@
#include "qdeclarativecustomparser_p_p.h"
#include "qdeclarativeparser_p.h"
+#include "qdeclarativecompiler_p.h"
#include <QtCore/qdebug.h>
@@ -260,4 +261,15 @@ void QDeclarativeCustomParser::error(const QDeclarativeCustomParserNode& node, c
exceptions << error;
}
+/*!
+ If \a script is a simply enum expression (eg. Text.AlignLeft),
+ returns the integer equivalent (eg. 1).
+
+ Otherwise, returns -1.
+*/
+int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const
+{
+ return compiler->evaluateEnum(script);
+}
+
QT_END_NAMESPACE