Hi Aleksi,

You could use a Repeater to fill the ComboBox's ContextMenu and then 
dynamically change the model of the Repeater. E.g.

ComboBox {
    menu: ContextMenu {
          Repeater { 
               model: ListModel { id: listModel }
               MenuItem { text: model.name }
          }
     }
}

function fillModel() {
     listModel.append({"name": "Click me"})
}


cheers,
Bea

________________________________________
From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of Stefan Lahner [lahner.ste...@gmx.at]
Sent: 17 June 2013 05:08
To: devel@lists.sailfishos.org
Subject: Re: [SailfishDevel] Dynamically filling up a Combobox

Hello,

maybe this (https://qt-project.org/wiki/QML-Dynamic-Objects) would help?
I never used it but this seam to be the way to do this.

Regards,
Stefan

Am 16.06.2013 20:52, schrieb Aleksi Suomalainen:
> Hello,
>
> I was wondering if there is a way to dynamically fill up a ComboBox
> Silica element in QML ?
>
> BR,
>
> Aleksi Suomalainen
> _______________________________________________
> SailfishOS.org Devel mailing list

_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to