provide adjustSize support; annoying and hackish, but it's the only way
svn path=/trunk/KDE/kdebase/runtime/; revision=1055319
This commit is contained in:
parent
0ab7db4524
commit
e28fc530cc
@ -810,6 +810,15 @@ QScriptValue SimpleJavaScriptApplet::newPlasmaFrameSvg(QScriptContext *context,
|
||||
return engine->newQObject(frameSvg);
|
||||
}
|
||||
|
||||
QScriptValue SimpleJavaScriptApplet::widgetAdjustSize(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(context->thisObject().toQObject());
|
||||
if (widget) {
|
||||
widget->adjustSize();
|
||||
}
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
void SimpleJavaScriptApplet::installWidgets(QScriptEngine *engine)
|
||||
{
|
||||
QScriptValue globalObject = engine->globalObject();
|
||||
@ -874,6 +883,7 @@ QScriptValue SimpleJavaScriptApplet::createWidget(QScriptContext *context, QScri
|
||||
|
||||
QScriptValue fun = engine->newQObject(w);
|
||||
fun.setPrototype(context->callee().property("prototype"));
|
||||
fun.setProperty("adjustSize", engine->newFunction(widgetAdjustSize));
|
||||
|
||||
//register enums will be accessed for instance as frame.Sunken for Frame shadow...
|
||||
registerEnums(engine, fun, *w->metaObject());
|
||||
|
@ -84,6 +84,7 @@ private:
|
||||
static QScriptValue notSupported(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue print(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue createPrototype(QScriptEngine *engine, const QString &name);
|
||||
static QScriptValue widgetAdjustSize(QScriptContext *context, QScriptEngine *engine);
|
||||
|
||||
private:
|
||||
static KSharedPtr<UiLoader> s_widgetLoader;
|
||||
|
Loading…
x
Reference in New Issue
Block a user