aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview.cpp
diff options
context:
space:
mode:
authorYulong Bai <yulong.bai@qt.io>2019-04-30 15:00:23 +0200
committerYulong Bai <yulong.bai@qt.io>2019-06-28 11:32:26 +0200
commit512b65fcf3359d8fb6736dc0e7dfd071354f3c25 (patch)
tree1d2656fd90737636ada4eaff0e51c2464732a439 /src/quick/items/qquicktableview.cpp
parent08a83f41ed2f0f91968705b005775ae8147f8083 (diff)
QQuickTableView: Add usage of QQuickTableSectionSizeProvider
Change-Id: Ib8417729d439cf0c638dae7a43025aa315406793 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview.cpp')
-rw-r--r--src/quick/items/qquicktableview.cpp12
1 files changed, 12 insertions, 0 deletions
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;