summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controls/Private/BasicTableView.qml2
-rw-r--r--tests/auto/controls/data/tst_tableview.qml26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/controls/Private/BasicTableView.qml b/src/controls/Private/BasicTableView.qml
index 518f43afc..4e1c45ab0 100644
--- a/src/controls/Private/BasicTableView.qml
+++ b/src/controls/Private/BasicTableView.qml
@@ -346,7 +346,7 @@ ScrollView {
frameVisible: true
__scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0
- __viewTopMargin: headerrow.height
+ __viewTopMargin: headerVisible ? headerrow.height : 0
/*! \internal
Use this to display user-friendly messages in TableView and TreeView common functions.
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 468c7eeb0..9bb2cd673 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -69,6 +69,32 @@ TestCase {
]
}
+ function test_QTBUG_46468() {
+ var table = Qt.createQmlObject('import QtQuick.Controls 1.3; \n\
+ import QtQuick 2.4; \n\
+ TableView { \n\
+ headerVisible: false; \n\
+ TableViewColumn{} \n\
+ model: 10; \n\
+ }', testCase, '')
+ wait(50);
+ verify(table.__viewTopMargin === 0)
+ table.destroy()
+ }
+
+ function test_headervisible() {
+ var table = Qt.createQmlObject('import QtQuick.Controls 1.3; \n\
+ import QtQuick 2.4; \n\
+ TableView { \n\
+ headerVisible: true; \n\
+ TableViewColumn{} \n\
+ model: 10; \n\
+ }', testCase, '')
+ wait(50);
+ verify(table.__viewTopMargin > 0)
+ table.destroy()
+ }
+
function test_basic_setup() {
var test_instanceStr =
'import QtQuick 2.2; \