From 3dcc9dde65c780fb87ff9feef60dfb16d6748eb0 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 7 Feb 2019 15:09:37 +0100 Subject: QQuickTableView: ensure we end up caching the correct value After the call to the application, we check the return value and adjust it if it's e.g NaN. And we need to cache the adjusted value, not the raw return value, otherwise the getColumnWidth()/getRowHeight() functions might return different values on subsequent calls. Change-Id: I7f3134f599b9863641132811ab7d5883cc02857b Reviewed-by: Mitch Curtis --- src/quick/items/qquicktableview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 75cafbc1a0..28871e8068 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1112,8 +1112,6 @@ qreal QQuickTableViewPrivate::getColumnWidth(int column) if (columnWidthProvider.isCallable()) { auto const columnAsArgument = QJSValueList() << QJSValue(column); columnWidth = columnWidthProvider.call(columnAsArgument).toNumber(); - cachedColumnWidth.startIndex = column; - cachedColumnWidth.size = columnWidth; if (qIsNaN(columnWidth) || columnWidth < 0) columnWidth = noExplicitColumnWidth; } else { @@ -1124,6 +1122,8 @@ qreal QQuickTableViewPrivate::getColumnWidth(int column) columnWidth = noExplicitColumnWidth; } + cachedColumnWidth.startIndex = column; + cachedColumnWidth.size = columnWidth; return columnWidth; } @@ -1146,8 +1146,6 @@ qreal QQuickTableViewPrivate::getRowHeight(int row) if (rowHeightProvider.isCallable()) { auto const rowAsArgument = QJSValueList() << QJSValue(row); rowHeight = rowHeightProvider.call(rowAsArgument).toNumber(); - cachedRowHeight.startIndex = row; - cachedRowHeight.size = rowHeight; if (qIsNaN(rowHeight) || rowHeight < 0) rowHeight = noExplicitRowHeight; } else { @@ -1158,6 +1156,8 @@ qreal QQuickTableViewPrivate::getRowHeight(int row) rowHeight = noExplicitRowHeight; } + cachedRowHeight.startIndex = row; + cachedRowHeight.size = rowHeight; return rowHeight; } -- cgit v1.2.3