Hi,

Yes, it's normal when alternatingRowColors is true, which it is by default. 
That is so that it doesn't look like the table is truncated when there's not 
enough rows to fill the table height. Just set alternatingRowColors to false 
and it should go away. (If you still need the feature, test for 
styleData.rowIndex % 2 in your row delegate.)


Best regards,

Dr. Gabriel de Dietrich
Senior Software Developer
The Qt Company - www.qt.io



________________________________
From: interest-bounces+gabriel.dedietrich=theqtcompany....@qt-project.org 
<interest-bounces+gabriel.dedietrich=theqtcompany....@qt-project.org> on behalf 
of Shantanu Tushar <[email protected]>
Sent: Tuesday, March 24, 2015 5:41 PM
To: [email protected]
Subject: [Interest] QML TableView creating extra row delegates

Hi list,

I noticed that the QML TableView creates extra row delegates even if there are 
only a few items in the model. For example the following code-

TableView {
        anchors.fill: parent
        model: ListModel {
            ListElement { name: "Apple"; cost: 2.45 }
            ListElement { name: "Orange"; cost: 3.25 }
            ListElement { name: "Banana"; cost: 1.95 }
        }
        rowDelegate: Rectangle {
            height: 64; width: parent.width
            color: "red"; radius: 10
        }
        TableViewColumn {
            role: "name"; title: "Name"; width: 200
        }
    }

The TableView that this gives looks like http://i.imgur.com/h1f1Q3F.png 
(apologies for the red :P)

Is this expected behavior? If yes, how do I make sure not to handle interaction 
on the invalid rowDelegates?

Cheers,

--
Shantanu Tushar    (UTC +0530)
shantanu.io<http://shantanu.io>
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to