[Interest] How to ensure the ListView header is at the beginning of the view

Gianluca gmaxera at gmail.com
Mon Apr 6 19:13:07 CEST 2015


Dear all,
I have a ListView with an header component that occupy a lot of space on small devices (more than the screen), and when the ListView is loaded it initial setup the content in order to display the first item but in that way the header is scrolled up.
This is unwanted behavior for me. I don’t care if there is no item visible in the screen, what is important for me is to view the header correctly.

You can see the attachments. The name of the image file describe what I want.

Any suggestions ?

One solution I tried to follow was to set a different delegate only for the first item.
For doing so, I tried to construct a VisualItemModel using a repeater inside, but does not work:

VisualItemModel {
    id: visualModel
    HeaderComponent { … }
    Repeater {
       model: itemModels
       delegate: itemDelegate { … }
    }
}

ListView {
    model: visualModel
    …
}

In this way, only the header component is visualized and none of the items created by the Repeater.

Thanks,
Gianluca.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150406/8c978e82/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unwanted_behavior_at_startup.png
Type: image/png
Size: 103263 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150406/8c978e82/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wanted_behavior_at_startup.png
Type: image/png
Size: 220535 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150406/8c978e82/attachment-0001.png>


More information about the Interest mailing list