How to convert list<size> to list<string>?



  • I want to make the result of Camera::supportedViewfinderResolutions() a model for a ComboBox. Simple assigning like

    myCombo.model = myCamera.supportedViewfinderResolutions()
    

    produces:

    ...
    my.qml:610:23: Unable to assign QJSValue to QString
    my.qml:610:23: Unable to assign QJSValue to QString
    my.qml:610:23: Unable to assign QJSValue to QString
    ...
    

    How do I do that properly?



  • Well, I found a solution. Not sure if it's the best one.

    function foo()
    {
        myCombo.model = myCamera.supportedViewfinderResolutions().map(function(item, i, arr)
        {
           return item.width + "x" + item.height
        })
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.