[Interest] Row, Column, Repeater, and ListView spacer delegate?

Mitch Curtis mitch.curtis at qt.io
Thu Jun 30 09:13:18 CEST 2016


Nope. The only way to do it is like you've mentioned:

import QtQuick 2.7
import QtQuick.Window 2.2

Window {
    visible: true
    width: 640
    height: 480

    ListView {
        id: listView
        width: 200
        height: 400
        clip: true
        model: 10
        delegate: Item {
            width: 200
            height: 50

            Text {
                text: modelData
                anchors.centerIn: parent
            }

            Rectangle {
                y: parent.height - height
                width: parent.width
                height: 1
                color: "black"
                visible: index < listView.count - 1
            }
        }

        Rectangle {
            anchors.fill: parent
            color: "transparent"
            border.color: "darkorange"
        }
    }
}

I don't think it's a huge deal; that item is only going to be hidden (and hence useless) when you're at the bottom of the view.

> -----Original Message-----
> From: Interest [mailto:interest-bounces+mitch.curtis=qt.io at qt-project.org]
> On Behalf Of Jason H
> Sent: Wednesday, 29 June 2016 6:39 PM
> To: interestqt-project.org <interest at qt-project.org>
> Subject: [Interest] Row, Column, Repeater, and ListView spacer delegate?
> 
> It would be really cool if Row, Column, Repeater, ListView supported a
> spacer delegate. So I could do:
> A | B | C
> And not just:
> A  B  C
> 
> Is there a way I'm not thinking of? I don't want to include the bar in the
> delegate because then I always get an extra: either at the start or end of
> the list.
> 
> 
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list