[Interest] Strange ordering problem with ComboBox
Shantanu Tushar
shaan7in at gmail.com
Wed Apr 13 09:10:27 CEST 2016
I haven't experienced exactly the same, but I did experience that if I use
a QSortFilterProxyModel as a model for ComboBox and the sort order changes,
ComboBox doesn't update itself. (A ListView connected with the same model
updates).
On Mon, Apr 11, 2016 at 3:06 PM, Gian Maxera <gmaxera at gmail.com> wrote:
> Hello,
> I’m using the ComboBox item of QML with more than two Items with a
> ListModel like that:
>
> ComboBox {
>
> id: rateType
>
> anchors.horizontalCenter: parent.horizontalCenter
>
> width: parent.width*0.9
>
> Component.onCompleted: {
>
> if ( models.appointment.lead == null ) {
>
> rateType.currentIndex = 0
>
> } else if ( models.appointment.lead.type == 'contact' ) {
>
> rateType.currentIndex = 0
>
> } else if ( models.appointment.lead.type == 'brochure' ) {
>
> rateType.currentIndex = 1
>
> } else if ( models.appointment.lead.type == 'tentative' ) {
>
> rateType.currentIndex = 2
>
> } else if ( models.appointment.lead.type == 'definite' ) {
>
> rateType.currentIndex = 3
>
> }
>
> }
>
> model: ListModel {
>
> ListElement {
>
> leadType: 'contact'
>
> leadText: 'Contact only'
>
> }
>
> ListElement {
>
> leadType: 'brochure'
>
> leadText: 'Brochure request'
>
> }
>
> ListElement {
>
> leadType: 'tentative'
>
> leadText: 'Tentative lead'
>
> }
>
> ListElement {
>
> leadType: 'definite'
>
> leadText: 'Definite lead'
>
> }
>
> }
>
> textRole: "leadText"
>
>
> But the popup menu appearing for select the option contain the elements
> into a different order than ListModel and when you select one of those the
> ComboBox select a different one. In such a way that it seems the index are
> correct but the labels of the popup menu are wrong.
>
> Someone hits this error before ?
>
> I’m using Qt 5.5 for now.
>
> Ciao,
> Gianluca.
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
--
Shantanu Tushar (UTC +0530)
shantanu.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160413/f52b3393/attachment.html>
More information about the Interest
mailing list