diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-08-02 14:49:13 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-11-13 12:51:04 +0000 |
commit | ed87e837ffae06a5770891aa49e1f82c8b58eeec (patch) | |
tree | 857bd7d0026b37fd6e0a741791fdfc280108163d /tests/manual | |
parent | 1425995a8b0e7e35b90bf93c3f9d4fe4e7e2b887 (diff) |
Add SplitView
SplitView is an important tool for desktop applications that do not
want to use a dock widget-style approach for their user interface.
It allows users to have some degree of control over the sizing of
elements in the UI, as well as the ability to conveniently serialize
those sizes so that they're remembered across sessions.
The main differences between this and the SplitView in
Qt Quick Controls 1 are:
- Has its own SplitView attached properties, rather than relying on
the Layout attached properties (which required an additional import).
- Uses the attached preferredWidth and preferredHeight properties
as well as Item's implicitWidth/implicitHeight properties
for the preferred size of items, rather than using the width and
height properties.
- Inherits from Container, so supports most of its API (though some
parts of the API, like the currentIndex-related stuff, make no
sense for SplitView).
- Uses attached SplitHandle properties for the handle delegate to
visualize hovered/pressed effects.
- Offers convenience API for serializing the user's preferred sizes.
[ChangeLog][Controls][SplitView] Introduced SplitView, a control that
lays out items horizontally or vertically with a draggable splitter
between each item.
Task-number: QTBUG-56318
Change-Id: I3da91643ab312eb9ef5b0567da4e758f17747192
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/testbench/controls/SplitView.qml | 79 | ||||
-rw-r--r-- | tests/manual/testbench/qml.qrc | 1 |
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/manual/testbench/controls/SplitView.qml b/tests/manual/testbench/controls/SplitView.qml new file mode 100644 index 00000000..7d534de4 --- /dev/null +++ b/tests/manual/testbench/controls/SplitView.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Controls 2.5 + +QtObject { + property var supportedStates: [ + [] + ] + + property Component component: SplitView { + implicitWidth: 400 + implicitHeight: 100 + + Rectangle { + color: "salmon" + implicitWidth: 25 + implicitHeight: 25 + } + Rectangle { + color: "navajowhite" + implicitWidth: 100 + implicitHeight: 100 + } + Rectangle { + color: "steelblue" + implicitWidth: 200 + implicitHeight: 200 + } + } +} diff --git a/tests/manual/testbench/qml.qrc b/tests/manual/testbench/qml.qrc index a0927f35..743e6629 100644 --- a/tests/manual/testbench/qml.qrc +++ b/tests/manual/testbench/qml.qrc @@ -40,5 +40,6 @@ <file>controls/BusyIndicator.qml</file> <file>testbench.qml</file> <file>controls/MenuBar.qml</file> + <file>controls/SplitView.qml</file> </qresource> </RCC> |