fix color api
svn path=/trunk/KDE/kdebase/runtime/; revision=1054898
This commit is contained in:
parent
bc053f81c1
commit
65ec9a6bcb
@ -55,57 +55,49 @@ static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
static QScriptValue red(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue red(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QColor, red);
|
DECLARE_SELF(QColor, red);
|
||||||
return QScriptValue(eng, self->red());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QScriptValue setRed(QScriptContext *ctx, QScriptEngine *)
|
if (ctx->argumentCount() > 0) {
|
||||||
{
|
QScriptValue arg = ctx->argument(0);
|
||||||
DECLARE_SELF(QColor, setRed);
|
self->setRed(arg.toInt32());
|
||||||
QScriptValue arg = ctx->argument(0);
|
}
|
||||||
self->setRed(arg.toInt32());
|
|
||||||
return arg;
|
return QScriptValue(eng, self->red());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue green(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue green(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QColor, green);
|
DECLARE_SELF(QColor, green);
|
||||||
return QScriptValue(eng, self->green());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QScriptValue setGreen(QScriptContext *ctx, QScriptEngine *)
|
if (ctx->argumentCount() > 0) {
|
||||||
{
|
QScriptValue arg = ctx->argument(0);
|
||||||
DECLARE_SELF(QColor, setGreen);
|
self->setGreen(arg.toInt32());
|
||||||
QScriptValue arg = ctx->argument(0);
|
}
|
||||||
self->setGreen(arg.toInt32());
|
|
||||||
return arg;
|
return QScriptValue(eng, self->green());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue blue(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue blue(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QColor, blue);
|
DECLARE_SELF(QColor, blue);
|
||||||
return QScriptValue(eng, self->blue());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QScriptValue setBlue(QScriptContext *ctx, QScriptEngine *)
|
if (ctx->argumentCount() > 0) {
|
||||||
{
|
QScriptValue arg = ctx->argument(0);
|
||||||
DECLARE_SELF(QColor, setBlue);
|
self->setBlue(arg.toInt32());
|
||||||
QScriptValue arg = ctx->argument(0);
|
}
|
||||||
self->setBlue(arg.toInt32());
|
|
||||||
return arg;
|
return QScriptValue(eng, self->blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue alpha(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue alpha(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QColor, alpha);
|
DECLARE_SELF(QColor, alpha);
|
||||||
return QScriptValue(eng, self->alpha());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QScriptValue setAlpha(QScriptContext *ctx, QScriptEngine *)
|
if (ctx->argumentCount() > 0) {
|
||||||
{
|
QScriptValue arg = ctx->argument(0);
|
||||||
DECLARE_SELF(QColor, setAlpha);
|
self->setAlpha(arg.toInt32());
|
||||||
QScriptValue arg = ctx->argument(0);
|
}
|
||||||
self->setAlpha(arg.toInt32());
|
|
||||||
return arg;
|
return QScriptValue(eng, self->alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QScriptValue isValid(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue isValid(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
@ -119,15 +111,11 @@ QScriptValue constructColorClass(QScriptEngine *eng)
|
|||||||
QScriptValue proto = qScriptValueFromValue(eng, QColor());
|
QScriptValue proto = qScriptValueFromValue(eng, QColor());
|
||||||
QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
|
QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
|
||||||
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
||||||
proto.setProperty("red", eng->newFunction(red), getter);
|
proto.setProperty("red", eng->newFunction(red), getter | setter);
|
||||||
proto.setProperty("setRed", eng->newFunction(setRed));
|
proto.setProperty("green", eng->newFunction(green), getter | setter);
|
||||||
proto.setProperty("green", eng->newFunction(green), getter);
|
proto.setProperty("blue", eng->newFunction(blue), getter | setter);
|
||||||
proto.setProperty("setGreen", eng->newFunction(setGreen));
|
proto.setProperty("alpha", eng->newFunction(alpha), getter | setter);
|
||||||
proto.setProperty("blue", eng->newFunction(blue), getter);
|
proto.setProperty("isValid", eng->newFunction(isValid), getter);
|
||||||
proto.setProperty("setBlue", eng->newFunction(setBlue));
|
|
||||||
proto.setProperty("alpha", eng->newFunction(alpha, getter));
|
|
||||||
proto.setProperty("setAlpha", eng->newFunction(setAlpha));
|
|
||||||
proto.setProperty("isValid", eng->newFunction(red), getter);
|
|
||||||
|
|
||||||
eng->setDefaultPrototype(qMetaTypeId<QColor>(), proto);
|
eng->setDefaultPrototype(qMetaTypeId<QColor>(), proto);
|
||||||
eng->setDefaultPrototype(qMetaTypeId<QColor*>(), proto);
|
eng->setDefaultPrototype(qMetaTypeId<QColor*>(), proto);
|
||||||
|
Loading…
Reference in New Issue
Block a user