summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@theqtcompany.com>2015-06-04 10:09:36 +0300
committerJoni Poikelin <joni.poikelin@theqtcompany.com>2015-06-04 10:21:18 +0000
commit1c49a841d9daa7bc498e35b8cc0331e04e96ec70 (patch)
tree1ce24d4a956300a28e47aba137a531da40c7e8d5
parente648611e6d64891f1723a0e32c783c8d5f994de1 (diff)
Fix TableView extra row with headerVisible:false
Task-number: QTBUG-46468 Change-Id: I6718bc860f26a287ff4580e4844aec225c0f70b7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
-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; \