aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-01 12:36:47 +0200
committerLars Knoll <lars.knoll@qt.io>2018-06-04 13:03:13 +0000
commitaf46cc19937dd8d33538e62ad5ebfed8e958a8f5 (patch)
treef369703facac3d2b1a0fc599c20a60c0a0a5222f /src/quick/items/qquicktableview_p.h
parent07946c110b3d6fde378dc2a6e821b318c4a68536 (diff)
TableView: fall back to use implicit size for delegate items
Rather than forcing users to set TableView.cellWidth/cellHeight (and therefore also force them to create an attached object for every cell), we now also accept setting implict size as a fall back. Change-Id: I4c4c4d23fe7fc193581728d3878cf2c7e40c0745 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview_p.h')
-rw-r--r--src/quick/items/qquicktableview_p.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/quick/items/qquicktableview_p.h b/src/quick/items/qquicktableview_p.h
index 0589d83f50..f3a589b9e4 100644
--- a/src/quick/items/qquicktableview_p.h
+++ b/src/quick/items/qquicktableview_p.h
@@ -54,6 +54,7 @@
#include <QtCore/qpointer.h>
#include <QtQuick/private/qtquickglobal_p.h>
#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQml/private/qqmlnullablevalue_p.h>
QT_BEGIN_NAMESPACE
@@ -158,19 +159,19 @@ public:
Q_EMIT tableViewChanged();
}
- qreal cellWidth() const { return m_cellSize.width(); }
+ qreal cellWidth() const { return m_cellWidth; }
void setCellWidth(qreal newWidth) {
- if (newWidth == m_cellSize.width())
+ if (newWidth == m_cellWidth)
return;
- m_cellSize.setWidth(newWidth);
+ m_cellWidth = newWidth;
Q_EMIT cellWidthChanged();
}
- qreal cellHeight() const { return m_cellSize.height(); }
+ qreal cellHeight() const { return m_cellHeight; }
void setCellHeight(qreal newHeight) {
- if (newHeight == m_cellSize.height())
+ if (newHeight == m_cellHeight)
return;
- m_cellSize.setHeight(newHeight);
+ m_cellHeight = newHeight;
Q_EMIT cellHeightChanged();
}
@@ -201,7 +202,10 @@ private:
QPointer<QQuickTableView> m_tableview;
int m_row = -1;
int m_column = -1;
- QSizeF m_cellSize;
+ QQmlNullableValue<qreal> m_cellWidth;
+ QQmlNullableValue<qreal> m_cellHeight;
+
+ friend class QQuickTableViewPrivate;
};
QT_END_NAMESPACE