[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdebase/runtime/plasma/scriptengines/javascript/simplebindings
From: Bruno de Oliveira Abinader <brunoabinader () gmail ! com>
Date: 2010-03-01 21:37:59
Message-ID: 1267479479.345527.10483.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1097686 by abinader:
Added support for passing QEasingCurve::Type enumerator literal string as valid \
argument on type() js binding
M +10 -2 easingcurve.cpp
--- branches/KDE/4.4/kdebase/runtime/plasma/scriptengines/javascript/simplebindings/easingcurve.cpp \
#1097685:1097686 @@ -17,6 +17,7 @@
*/
#include <QEasingCurve>
+#include <QMetaEnum>
#include <QScriptValue>
#include <QScriptEngine>
#include <QScriptContext>
@@ -55,13 +56,20 @@
if (ctx->argumentCount()) {
QScriptValue arg = ctx->argument(0);
+
+ qint32 type = -1;
if (arg.isNumber()) {
- qint32 type = arg.toInt32();
+ type = arg.toInt32();
+ } else if (arg.isString()) {
+ QMetaObject meta = QEasingCurve::staticMetaObject;
+ QMetaEnum easingCurveEnum = \
meta.enumerator(meta.indexOfEnumerator("Type")); +
+ type = easingCurveEnum.keyToValue(arg.toString().toAscii().data());
+ }
if (type > -1 && type < QEasingCurve::Custom) {
self->setType(static_cast<QEasingCurve::Type>(type));
}
}
- }
return QScriptValue(eng, self->type());
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic