From a869f09e00bf2920f418eff799ed3cf46884eed6 Mon Sep 17 00:00:00 2001 From: Artur Duque de Souza Date: Fri, 6 Nov 2009 03:51:53 +0000 Subject: [PATCH] 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 --- scriptengines/javascript/qtgui/anchorlayout.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scriptengines/javascript/qtgui/anchorlayout.cpp b/scriptengines/javascript/qtgui/anchorlayout.cpp index 10a444842..5780936ee 100644 --- a/scriptengines/javascript/qtgui/anchorlayout.cpp +++ b/scriptengines/javascript/qtgui/anchorlayout.cpp @@ -89,7 +89,7 @@ BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, addAnchor) { QGraphicsAnchor *anchor = self->addAnchor(item1, static_cast(ctx->argument(1).toInt32()), item2, static_cast(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(eng, new QGraphicsAnchorLayout(), QScript::UserOwnership); + QScriptValue proto = + QScript::wrapPointer(eng, + new QGraphicsAnchorLayout(), + QScript::UserOwnership); ADD_METHOD(proto, setSpacing); ADD_GET_SET_METHODS(proto, horizontalSpacing, setHorizontalSpacing); ADD_GET_SET_METHODS(proto, verticalSpacing, setVerticalSpacing);