[Interest] QML ListView/Model currentIndexChanges not firing for synamic models

Dmitry Volosnykh dmitry.volosnykh at gmail.com
Mon Jun 29 20:28:13 CEST 2015


Jason, the only commented out line I see there is misspelled name of the
component file.
Also, I am able to interect each of three list views, and I see running
numbers corresponding to current indices.
What should be done to reproduce your issue, and how to know that the flaw
was found?

On Mon, Jun 29, 2015 at 8:40 PM, Jason H <jhihn at gmx.com> wrote:

> Wouldn't you know it? In constructing the minimal example, the bug was
> found.
>
> It seems that the currentIndex was being initialized. For the monthModel,
> it existed. For the dynamically created model it didn't. It seems a bug
> though to never be able to  update the currentIndex though. We even tried
> to set currentItem after creating the model and it did not work. The intent
> was to initialize the list to June, in the vertical middle .
>
> You'll see the commented line in StyledPicker.qml.
>
> Sample attached.
>
>  *Sent:* Monday, June 29, 2015 at 1:16 PM
> *From:* "Dmitry Volosnykh" <dmitry.volosnykh at gmail.com>
> *To:* "Jason H" <jhihn at gmx.com>
> *Cc:* "interest at qt-project.org" <interest at qt-project.org>
> *Subject:* Re: [Interest] QML ListView/Model currentIndexChanges not
> firing for synamic models
>  Could you provide complete example?
>
> On Mon, Jun 29, 2015 at 8:10 PM, Jason H <jhihn at gmx.com> wrote:
>>
>> We have two scrolling pickers which are based on ListView. They are the
>> same QML Component. When one is assigned a static model
>> (ListModel/ListElement) it works. When it is created programmatically, it
>> does not.
>>
>> What is going wrong? We've looked into dynamicRoles and tried using sync()
>>
>> Thanks in advance,
>>
>> ListModel {
>> id: dayModel
>> component.onCompleted {
>>  for (var i=1; i< 32; i++)
>>   append( { value: i.toString() } )
>> }
>> }
>>
>> ListModel {
>>   id: monthModel
>>   ListElement {...}
>>   ...
>> }
>>
>> Meanwhile in ListView...
>> ListView {
>> model: dayModel
>> onCurrentIndexChanged: console.log(index) // never works
>> }
>>
>> ListView {
>> model: monthModel
>> onCurrentIndexChanged: console.log(index) // works
>> }
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150629/9c4c6807/attachment.html>


More information about the Interest mailing list