diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-09-07 14:13:51 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-09-10 09:31:04 +0000 |
commit | 5ec0599032b78d628ab562d839ae4bf2414c7bf6 (patch) | |
tree | 60da351e66de16a4f655d57734e81bf8114c3850 /tests/auto/quick/qquicktableview/data | |
parent | 2aaf007c1367f58ce80bc660c56ab2c3284d1388 (diff) |
QQuickTableView: don't set contentX/Y to zero when building the table
Don't reset the content item to 0,0 when we do a rebuild of the
table, since that will overwrite whatever the user has set to contentX/Y
explicitly. Doing the latter can be handy if he needs to flick the table
to a start position upon construction. If the user want's to move the
content item back to origin when changing the model, he can instead do
so manually.
Change-Id: Ic7bc424312569e49115dea5037dd1109261a3aff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktableview/data')
-rw-r--r-- | tests/auto/quick/qquicktableview/data/setcontentpos.qml | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktableview/data/setcontentpos.qml b/tests/auto/quick/qquicktableview/data/setcontentpos.qml new file mode 100644 index 0000000000..bff97e4e5e --- /dev/null +++ b/tests/auto/quick/qquicktableview/data/setcontentpos.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Window 2.3 + +Item { + width: 640 + height: 450 + + property alias tableView: tableView + + TableView { + id: tableView + width: 600 + height: 400 + anchors.margins: 1 + clip: true + delegate: tableViewDelegate + columnSpacing: 1 + rowSpacing: 1 + contentX: 250 + contentY: 250 + } + + Component { + id: tableViewDelegate + Rectangle { + implicitWidth: 100 + implicitHeight: 100 + color: "lightgray" + } + } + +} |