summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-10-14 16:19:09 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-15 10:16:45 +0200
commit2bd4c2f4dfe84bd30d96dac65d6d06d9df5a4558 (patch)
tree92806a791e9e3355f00adec2f091e47142445253
parent288f9a9899fa39b5178d7df9e207c6b1af070e16 (diff)
downloadqtquickcontrols-2bd4c2f4dfe84bd30d96dac65d6d06d9df5a4558.tar.gz
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 <jpnurmi@digia.com>
-rw-r--r--src/controls/TableView.qml14
1 files 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