diff options
author | Nicolas Ettlin <nicolas.ettlin@me.com> | 2018-07-13 15:48:57 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-07-18 18:22:23 +0000 |
commit | ab1df24c8283cafd76f05c86004963c4c2d0673f (patch) | |
tree | 17c7764e393ca21f66293addcc831e745bc56d20 /tests/auto/quick/qquicktableview/data | |
parent | 790e2f37d451933c4fe24c64e655e65e9e9c0a05 (diff) |
Qt Quick Table View: set the default row and column spacing to 0
Currently, in the TableView QML component, the initial row and column
spacing is set to (-1, -1), as in the default QSizeF constructor. As
the negative spacing was ignored when positioning the items, but taken
in account when computing the total content size, it caused an issue
where the user wouldn’t be able to scroll to the bottom right corner of
the TableView. This commit fixes this issue by setting a default
spacing to (0, 0). It also prevents the developer from using invalid
spacing values (such as negative numbers, NaN or Infinite).
Task-number: QTBUG-69454
Change-Id: I343475790c384954372afad0a778f8da7dff0b0d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktableview/data')
-rw-r--r-- | tests/auto/quick/qquicktableview/data/tableviewdefaultspacing.qml | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktableview/data/tableviewdefaultspacing.qml b/tests/auto/quick/qquicktableview/data/tableviewdefaultspacing.qml new file mode 100644 index 0000000000..0212d5b9a4 --- /dev/null +++ b/tests/auto/quick/qquicktableview/data/tableviewdefaultspacing.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Window 2.3 +import Qt.labs.tableview 1.0 + +Item { + width: 640 + height: 450 + + property alias tableView: tableView + + TableView { + id: tableView + width: 600 + height: 400 + anchors.margins: 1 + delegate: tableViewDelegate + } + + Component { + id: tableViewDelegate + Rectangle { + objectName: "tableViewDelegate" + color: "lightgray" + border.width: 1 + implicitWidth: 15 + implicitHeight: 10 + Text { + anchors.centerIn: parent + text: modelData + } + } + } + +} |