make isActive a setter as well, more javascriptty
svn path=/trunk/KDE/kdebase/runtime/; revision=1063077
This commit is contained in:
parent
47deeea77c
commit
f266a263db
@ -45,24 +45,37 @@ static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
static QScriptValue singleShot(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue singleShot(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QTimer, start);
|
DECLARE_SELF(QTimer, start);
|
||||||
|
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
self->setSingleShot(ctx->argument(0).toBool());
|
self->setSingleShot(ctx->argument(0).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
return QScriptValue(eng, self->isSingleShot());
|
return QScriptValue(eng, self->isSingleShot());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue interval(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue interval(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QTimer, interval);
|
DECLARE_SELF(QTimer, interval);
|
||||||
|
|
||||||
if (ctx->argumentCount()) {
|
if (ctx->argumentCount()) {
|
||||||
self->setInterval(ctx->argument(0).toInt32());
|
self->setInterval(ctx->argument(0).toInt32());
|
||||||
}
|
}
|
||||||
|
|
||||||
return QScriptValue(eng, self->interval());
|
return QScriptValue(eng, self->interval());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue isActive(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue isActive(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QTimer, isActive);
|
DECLARE_SELF(QTimer, isActive);
|
||||||
|
|
||||||
|
if (ctx->argumentCount()) {
|
||||||
|
if (ctx->argument(0).toBool()) {
|
||||||
|
self->start();
|
||||||
|
} else {
|
||||||
|
self->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return QScriptValue(eng, self->isActive());
|
return QScriptValue(eng, self->isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +88,7 @@ QScriptValue constructTimerClass(QScriptEngine *eng)
|
|||||||
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
||||||
proto.setProperty("singleShot", eng->newFunction(singleShot), getter | setter);
|
proto.setProperty("singleShot", eng->newFunction(singleShot), getter | setter);
|
||||||
proto.setProperty("interval", eng->newFunction(interval), getter | setter);
|
proto.setProperty("interval", eng->newFunction(interval), getter | setter);
|
||||||
proto.setProperty("isActive", eng->newFunction(isActive), getter);
|
proto.setProperty("isActive", eng->newFunction(isActive), getter | setter);
|
||||||
|
|
||||||
return eng->newFunction(ctor, proto);
|
return eng->newFunction(ctor, proto);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user