Return the correct object when creating anchors

addAnchor returns the anchor so the developer can set the spacing
and also size policies on the anchor (the last one is not possible
in js yet I think).


svn path=/trunk/KDE/kdebase/runtime/; revision=1045430
This commit is contained in:
Artur Duque de Souza 2009-11-06 03:51:53 +00:00
parent 26bf81a282
commit a869f09e00

View File

@ -89,7 +89,7 @@ BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, addAnchor) {
QGraphicsAnchor *anchor = self->addAnchor(item1, static_cast<Qt::AnchorPoint>(ctx->argument(1).toInt32()),
item2, static_cast<Qt::AnchorPoint>(ctx->argument(3).toInt32()));
return qScriptValueFromValue(eng, anchor);
return eng->newQObject(anchor, QScriptEngine::QtOwnership);
} END_DECLARE_METHOD
@ -108,7 +108,10 @@ public:
QScriptValue constructAnchorLayoutClass(QScriptEngine *eng)
{
QScriptValue proto = QScript::wrapPointer<QGraphicsAnchorLayout>(eng, new QGraphicsAnchorLayout(), QScript::UserOwnership);
QScriptValue proto =
QScript::wrapPointer<QGraphicsAnchorLayout>(eng,
new QGraphicsAnchorLayout(),
QScript::UserOwnership);
ADD_METHOD(proto, setSpacing);
ADD_GET_SET_METHODS(proto, horizontalSpacing, setHorizontalSpacing);
ADD_GET_SET_METHODS(proto, verticalSpacing, setVerticalSpacing);