[Development] Fwd: [Interest] Strange ordering problem with ComboBox

Gianluca gmaxera at gmail.com
Wed Apr 13 09:13:07 CEST 2016


Ok, let’s try to forward to development mailing list and see if we need to fire a bug.


Inizio messaggio inoltrato:

> Da: Shantanu Tushar <shaan7in at gmail.com>
> Oggetto: Re: [Interest] Strange ordering problem with ComboBox
> Data: 13 aprile 2016 08:10:27 GMT+1
> A: Gian Maxera <gmaxera at gmail.com>
> Cc: interest <interest at qt-project.org>
> 
> 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/development/attachments/20160413/570e60f3/attachment.html>


More information about the Development mailing list