[Interest] QML ListView anchoring fails

ashish dabhade ashishd157 at gmail.com
Tue Nov 11 07:52:56 CET 2014


Hi,

Thanks for your reply and the current workround.
Reported the bug. Please check
https://bugreports.qt-project.org/browse/QTBUG-42548

On Tue, Nov 11, 2014 at 12:00 PM, Nevala Samuel <
samuel.nevala at theqtcompany.com> wrote:

>  Hi,
>
>
>  It seems that delegates are already created when ListView is still
> re-sizing and that messes up the populate transition leaving some delegates
> to opacity zero. It is a bug can you report it @
> https://bugreports.qt-project.org/​ please.
>
>
>  Assigning  model after ListView has re-sized works with anchors and
> proofs that it is a bug.
>
>
>  ApplicationWindow {
>     id: main
>
>      visible: true
>     height: 300
>     width: 300
>
>
>      ListModel {
>         id: modelData
>         ListElement {
>             name: "Bill Smith"
>             number: "555 3264"
>         }
>         ListElement {
>             name: "John Brown"
>             number: "555 8426"
>         }
>         ListElement {
>             name: "Sam Wise"
>             number: "555 0473"
>         }
>     }
>
>      Rectangle {
>         anchors.fill: parent
>         ListView {
>             id: lw
>             anchors.fill: parent
>             onHeightChanged: lw.model = modelData
>             delegate: Rectangle {
>                 height: 40
>                 width: 300
>                 opacity: 0.0
>                 color: "lightgray"
>                 Text {
>                     anchors.centerIn: parent
>                     text: name
>                 }
>                 Component.onCompleted: console.log(name)
>             }
>
>              populate: Transition {
>                 NumberAnimation { property: "opacity"; to: 1.0 ; duration:
> 1000 }
>             }
>         }
>     }
> }
>
>
>  Samuel Nevala
>
>
>  ------------------------------
> *From:* interest-bounces+samuel.nevala=theqtcompany.com at qt-project.org
> <interest-bounces+samuel.nevala=theqtcompany.com at qt-project.org> on
> behalf of ashish dabhade <ashishd157 at gmail.com>
> *Sent:* Monday, November 10, 2014 12:45 PM
> *To:* interest at qt-project.org
> *Subject:* [Interest] QML ListView anchoring fails
>
>   Hi All,
>
>  Why is it that anchoring (fill) ListView to parent fails in following
> example ?
>
> ApplicationWindow {
>     id: main
>     visible: true
>     height: 300
>     width: 300
>
>     Rectangle {
>         anchors.fill: parent
>         ListView {
>             anchors.fill: parent
>             model: ListModel {
>                 id: modelData
>                 ListElement {
>                     name: "Bill Smith"
>                     number: "555 3264"
>                 }
>                 ListElement {
>                     name: "John Brown"
>                     number: "555 8426"
>                 }
>                 ListElement {
>                     name: "Sam Wise"
>                     number: "555 0473"
>                 }
>             }
>             delegate: Rectangle {
>                 height: 40
>                 width: 300
>                 opacity: 0.0
>                 color: "lightgray"
>                 Text {
>                     anchors.centerIn: parent
>                     text: name
>                 }
>             }
>             populate: Transition {
>                 NumberAnimation { property: "opacity"; to: 1.0; duration:
> 1000 }
>             }
>         }
>     }
> }
>
>  If ListView or Rectangle is given width or height it works as expected.
> Is it a bug or am i missing something ?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141111/4f785db6/attachment.html>


More information about the Interest mailing list