diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-02-07 15:09:37 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-02-14 10:39:19 +0000 |
commit | 3dcc9dde65c780fb87ff9feef60dfb16d6748eb0 (patch) | |
tree | 7907d4e19bba29c2539ae16232b517d993218095 /src/quick | |
parent | df867d86285c9c9115313c90d7d72ff9a245bce4 (diff) |
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 <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |