From 2bd4c2f4dfe84bd30d96dac65d6d06d9df5a4558 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 14 Oct 2013 16:19:09 +0200 Subject: Fix crash with TableView on android and show alternating rows when empty We were dividing by 0 when there were no visible rows on android. This fixes the issue and ensures there are alternating rows also when the view is empty. Change-Id: I1ed84235418d50ed476a7424285c52446a355095 Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 329976c5..827b1749 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -651,12 +651,22 @@ ScrollView { // Fills extra rows with alternate color Column { id: rowfiller - property int rowHeight: count ? listView.contentHeight/count : height + Loader { + id: rowSizeItem + sourceComponent: root.rowDelegate + visible: false + property QtObject styleData: QtObject { + property bool alternate: false + property bool selected: false + property bool hasActiveFocus: false + } + } + property int rowHeight: rowSizeItem.implicitHeight property int paddedRowCount: height/rowHeight property int count: listView.count y: listView.contentHeight width: parent.width - visible: listView.contentHeight > 0 && alternatingRowColors + visible: alternatingRowColors height: viewport.height - listView.contentHeight Repeater { model: visible ? parent.paddedRowCount : 0 -- cgit v1.2.1