[SailfishDevel] Dynamically filling up a Combobox

Bea Lam bea.lam at jollamobile.com
Mon Jun 17 02:06:16 UTC 2013


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-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of Stefan Lahner [lahner.stefan at gmx.at]
Sent: 17 June 2013 05:08
To: devel at 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


More information about the Devel mailing list