From 512b65fcf3359d8fb6736dc0e7dfd071354f3c25 Mon Sep 17 00:00:00 2001 From: Yulong Bai Date: Tue, 30 Apr 2019 15:00:23 +0200 Subject: QQuickTableView: Add usage of QQuickTableSectionSizeProvider Change-Id: Ib8417729d439cf0c638dae7a43025aa315406793 Reviewed-by: Richard Moe Gustavsen --- src/quick/items/qquicktableview.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/quick/items/qquicktableview.cpp') diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 30f6350a30..75e0a1018f 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -432,6 +432,10 @@ bool QQuickTableViewPrivate::EdgeRange::containsIndex(Qt::Edge edge, int index) QQuickTableViewPrivate::QQuickTableViewPrivate() : QQuickFlickablePrivate() { + QObject::connect(&columnWidths, &QQuickTableSectionSizeProvider::sizeChanged, + [this] { this->forceLayout();}); + QObject::connect(&rowHeights, &QQuickTableSectionSizeProvider::sizeChanged, + [this] { this->forceLayout();}); } QQuickTableViewPrivate::~QQuickTableViewPrivate() @@ -1280,6 +1284,10 @@ qreal QQuickTableViewPrivate::getColumnWidth(int column) if (syncHorizontally) return syncView->d_func()->getColumnWidth(column); + auto cw = columnWidths.size(column); + if (cw >= 0) + return cw; + if (columnWidthProvider.isUndefined()) return noExplicitColumnWidth; @@ -1317,6 +1325,10 @@ qreal QQuickTableViewPrivate::getRowHeight(int row) if (syncVertically) return syncView->d_func()->getRowHeight(row); + auto rh = rowHeights.size(row); + if (rh >= 0) + return rh; + if (rowHeightProvider.isUndefined()) return noExplicitRowHeight; -- cgit v1.2.3