[Interest] QML TableView creating extra row delegates
Shantanu Tushar
shaan7in at gmail.com
Fri Mar 27 11:25:11 CET 2015
Hi,
Thanks for the tip, it worked :) Maybe this should be a note in the
documentation for alternatingRowColors?
On Thu, Mar 26, 2015 at 4:39 PM, deDietrich Gabriel <
Gabriel.deDietrich at theqtcompany.com> wrote:
> 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
>
--
Shantanu Tushar (UTC +0530)
shantanu.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150327/01f7601a/attachment.html>
More information about the Interest
mailing list