Ok, here is what I found, it seems that using bindings in QML, values 
are transfered to child components but when changed inside child the 
value is not sent back to the parent:

//Parent.qml
Rectangle{
        property string title: "initial value"
        id: root

        Child{
                title: root.title
        }
}

//Child.qml
Rectangle{
        property string title
        id:child
        ...
        //JS script
        {
                child.title = "Child modified value";
                // I expected this to reflect back in parent or         
                // whatever component was bound to it
        }
        ...
        
}

Is this normal? Is there a workaround

Regards,
Cristi

Cristian Daniel Stamateanu wrote:
> Thanks Kent, You were right on both counts. I don't need a QScriptValue 
> and the value is not sent from qml for some reason. I will investigate 
> further.
> 
> BR.
> Cristian Stamateanu
> 
> On Tue, 29 Jun 2010 18:39:36 +0300, Kent Hansen <kent.han...@nokia.com> 
> wrote:
> 
>> Hi,
>>
>> On 29. juni 2010 16:58, ext Cristian Daniel Stamateanu wrote:
>>> Hello,
>>>
>>> I have the following problem : I have a class declaring the following 
>>> slot:
>>>
>>> void RssFeedManager::addFeedEx(const QScriptValue&  name,const
>>> QScriptValue&  address )
>>> {
>>>           bool nameIsString = name.isVariant();
>>>           QString str = name.toString();
>>>          ...
>>> }
>>>
>>> and I am calling this slot from QML
>>>
>>> This works ok:
>>> feedManager.addFeedEx( "whatever", addFeedView.address );
>>>
>>> while using a binding to a property declared in addFeedView like
>>> property string name;
>>>
>>> feedManager.addFeedEx( addFeedView.name, addFeedView.address );
>>>
>>> is not working.
>>> In the c++ side I am getting a string only it is an empty one.
>>>
>>> Any thoughts?
>>>
>>
>> Have you checked that the name is indeed non-empty on the JS side?
>> Does it work if you declare the slot as taking a QString argument (why
>> do want to receive it as a QScriptValue)?
>> What type is the script value, is it an object? If so, does
>> QScriptValue::toVariant() return anything? QML has a special "hook" to
>> allow converting a script value to a variant, but no hook for the
>> toString case AFAICT.
>>
>> Regards,
>> Kent
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml@trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
> 
> 

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to