[Interest] QML TableView creating extra row delegates
deDietrich Gabriel
Gabriel.deDietrich at theqtcompany.com
Thu Mar 26 12:09:52 CET 2015
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.com at qt-project.org <interest-bounces+gabriel.dedietrich=theqtcompany.com at qt-project.org> on behalf of Shantanu Tushar <shaan7in at gmail.com>
Sent: Tuesday, March 24, 2015 5:41 PM
To: interest at qt-project.org
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150326/b5aefa8f/attachment.html>
More information about the Interest
mailing list