aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-08-02 14:49:13 +0200
committerMitch Curtis <mitch.curtis@qt.io>2018-11-13 12:51:04 +0000
commited87e837ffae06a5770891aa49e1f82c8b58eeec (patch)
tree857bd7d0026b37fd6e0a741791fdfc280108163d /src/imports
parent1425995a8b0e7e35b90bf93c3f9d4fe4e7e2b887 (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 'src/imports')
-rw-r--r--src/imports/controls/SplitView.qml55
-rw-r--r--src/imports/controls/controls.pri1
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-splitview-custom.pngbin0 -> 383 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-splitview-custom.qml57
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc9
-rw-r--r--src/imports/controls/fusion/SplitView.qml56
-rw-r--r--src/imports/controls/fusion/fusion.pri1
-rw-r--r--src/imports/controls/imagine/SplitView.qml63
-rw-r--r--src/imports/controls/imagine/design/imagine.sketchbin293192 -> 164993 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-disabled.pngbin0 -> 93 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-disabled@2x.pngbin0 -> 99 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-disabled@3x.pngbin0 -> 112 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-disabled@4x.pngbin0 -> 130 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-hovered.pngbin0 -> 93 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-hovered@2x.pngbin0 -> 99 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-hovered@3x.pngbin0 -> 112 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-hovered@4x.pngbin0 -> 130 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-pressed.pngbin0 -> 93 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-pressed@2x.pngbin0 -> 99 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-pressed@3x.pngbin0 -> 112 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle-pressed@4x.pngbin0 -> 129 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle.pngbin0 -> 93 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle@2x.pngbin0 -> 99 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle@3x.pngbin0 -> 112 bytes
-rw-r--r--src/imports/controls/imagine/images/splitview-handle@4x.pngbin0 -> 130 bytes
-rw-r--r--src/imports/controls/imagine/imagine.pri1
-rw-r--r--src/imports/controls/material/SplitView.qml74
-rw-r--r--src/imports/controls/material/material.pri1
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp6
-rw-r--r--src/imports/controls/universal/SplitView.qml56
-rw-r--r--src/imports/controls/universal/universal.pri1
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp6
32 files changed, 387 insertions, 0 deletions
diff --git a/src/imports/controls/SplitView.qml b/src/imports/controls/SplitView.qml
new file mode 100644
index 00000000..1953cf69
--- /dev/null
+++ b/src/imports/controls/SplitView.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+
+T.SplitView {
+ id: control
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ handle: Rectangle {
+ implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width
+ implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6
+ color: T.SplitHandle.pressed ? control.palette.mid
+ : (T.SplitHandle.hovered ? control.palette.midlight : control.palette.button)
+ }
+}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 675fcf39..fbf5d075 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -53,6 +53,7 @@ QML_FILES += \
$$PWD/ScrollView.qml \
$$PWD/Slider.qml \
$$PWD/SpinBox.qml \
+ $$PWD/SplitView.qml \
$$PWD/StackView.qml \
$$PWD/SwipeDelegate.qml \
$$PWD/Switch.qml \
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-splitview-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-splitview-custom.png
new file mode 100644
index 00000000..7afd3ff8
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-splitview-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-splitview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-splitview-custom.qml
new file mode 100644
index 00000000..e202e836
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-splitview-custom.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+
+Item {
+ width: 200
+ height: 100
+
+ //! [1]
+ SplitView {
+ id: splitView
+ anchors.fill: parent
+
+ handle: Rectangle {
+ implicitWidth: 4
+ implicitHeight: 4
+ color: SplitHandle.pressed ? "#81e889"
+ : (SplitHandle.hovered ? Qt.lighter("#c2f4c6", 1.1) : "#c2f4c6")
+ }
+
+ Rectangle {
+ implicitWidth: 150
+ color: "#444"
+ }
+ Rectangle {
+ implicitWidth: 50
+ color: "#666"
+ }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index cabeb528..de13be9d 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -736,6 +736,15 @@
\snippet qtquickcontrols2-spinbox-custom.qml file
+ \section2 Customizing SplitView
+
+ SplitView consists of a visual \l {SplitView::handle}{handle} delegate.
+
+ \image qtquickcontrols2-splitview-custom.png
+
+ \snippet qtquickcontrols2-splitview-custom.qml 1
+
+
\section2 Customizing StackView
StackView can have a visual \l {Control::background}{background}
diff --git a/src/imports/controls/fusion/SplitView.qml b/src/imports/controls/fusion/SplitView.qml
new file mode 100644
index 00000000..4050b28a
--- /dev/null
+++ b/src/imports/controls/fusion/SplitView.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+
+T.SplitView {
+ id: control
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ handle: Rectangle {
+ implicitWidth: control.orientation === Qt.Horizontal ? 2 : control.width
+ implicitHeight: control.orientation === Qt.Horizontal ? control.height : 2
+ color: T.SplitHandle.pressed ? palette.dark
+ : (T.SplitHandle.hovered ? control.palette.midlight : control.palette.mid)
+ }
+}
diff --git a/src/imports/controls/fusion/fusion.pri b/src/imports/controls/fusion/fusion.pri
index c4493c09..72978db5 100644
--- a/src/imports/controls/fusion/fusion.pri
+++ b/src/imports/controls/fusion/fusion.pri
@@ -51,6 +51,7 @@ QML_FILES += \
$$PWD/SliderGroove.qml \
$$PWD/SliderHandle.qml \
$$PWD/SpinBox.qml \
+ $$PWD/SplitView.qml \
$$PWD/SwipeDelegate.qml \
$$PWD/SwitchDelegate.qml \
$$PWD/SwitchIndicator.qml \
diff --git a/src/imports/controls/imagine/SplitView.qml b/src/imports/controls/imagine/SplitView.qml
new file mode 100644
index 00000000..a90b3a86
--- /dev/null
+++ b/src/imports/controls/imagine/SplitView.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
+
+T.SplitView {
+ id: control
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ handle: NinePatchImage {
+ source: Imagine.url + "splitview-handle"
+ NinePatchImageSelector on source {
+ states: [
+ {"vertical": control.orientation === Qt.Vertical},
+ {"horizontal":control.orientation === Qt.Horizontal},
+ {"disabled": !control.enabled},
+ {"pressed": T.SplitHandle.pressed},
+ {"mirrored": control.mirrored},
+ {"hovered": T.SplitHandle.hovered}
+ ]
+ }
+ }
+}
diff --git a/src/imports/controls/imagine/design/imagine.sketch b/src/imports/controls/imagine/design/imagine.sketch
index ecb437f7..f3535b37 100644
--- a/src/imports/controls/imagine/design/imagine.sketch
+++ b/src/imports/controls/imagine/design/imagine.sketch
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled.png b/src/imports/controls/imagine/images/splitview-handle-disabled.png
new file mode 100644
index 00000000..0071c196
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-disabled.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png
new file mode 100644
index 00000000..67cee407
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png
new file mode 100644
index 00000000..84752ba9
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png
new file mode 100644
index 00000000..e4be8597
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered.png b/src/imports/controls/imagine/images/splitview-handle-hovered.png
new file mode 100644
index 00000000..1386d213
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-hovered.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png
new file mode 100644
index 00000000..4708a47b
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png
new file mode 100644
index 00000000..2ccc1ff5
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png
new file mode 100644
index 00000000..6929da70
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed.png b/src/imports/controls/imagine/images/splitview-handle-pressed.png
new file mode 100644
index 00000000..7face6b4
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-pressed.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png
new file mode 100644
index 00000000..ad940d0f
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png
new file mode 100644
index 00000000..d4e19dc2
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png
new file mode 100644
index 00000000..8ccbbebc
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle.png b/src/imports/controls/imagine/images/splitview-handle.png
new file mode 100644
index 00000000..c1dffa67
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle@2x.png b/src/imports/controls/imagine/images/splitview-handle@2x.png
new file mode 100644
index 00000000..180e266a
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle@2x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle@3x.png b/src/imports/controls/imagine/images/splitview-handle@3x.png
new file mode 100644
index 00000000..35ea51db
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle@3x.png
Binary files differ
diff --git a/src/imports/controls/imagine/images/splitview-handle@4x.png b/src/imports/controls/imagine/images/splitview-handle@4x.png
new file mode 100644
index 00000000..3a1e7e9f
--- /dev/null
+++ b/src/imports/controls/imagine/images/splitview-handle@4x.png
Binary files differ
diff --git a/src/imports/controls/imagine/imagine.pri b/src/imports/controls/imagine/imagine.pri
index cb6857a5..081a509e 100644
--- a/src/imports/controls/imagine/imagine.pri
+++ b/src/imports/controls/imagine/imagine.pri
@@ -30,6 +30,7 @@ QML_FILES += \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
$$PWD/SpinBox.qml \
+ $$PWD/SplitView.qml \
$$PWD/StackView.qml \
$$PWD/SwipeDelegate.qml \
$$PWD/SwipeView.qml \
diff --git a/src/imports/controls/material/SplitView.qml b/src/imports/controls/material/SplitView.qml
new file mode 100644
index 00000000..6e5eb54d
--- /dev/null
+++ b/src/imports/controls/material/SplitView.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+
+T.SplitView {
+ id: control
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ handle: Rectangle {
+ implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width
+ implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6
+ color: T.SplitHandle.pressed ? control.Material.background
+ : Qt.lighter(control.Material.background, T.SplitHandle.hovered ? 1.2 : 1.1)
+
+ Rectangle {
+ color: control.Material.secondaryTextColor
+ width: control.orientation === Qt.Horizontal ? thickness : length
+ height: control.orientation === Qt.Horizontal ? length : thickness
+ radius: thickness
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ property int length: parent.T.SplitHandle.pressed ? 3 : 8
+ readonly property int thickness: parent.T.SplitHandle.pressed ? 3 : 1
+
+ Behavior on length {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index ab925aa2..bda1fb21 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -53,6 +53,7 @@ QML_FILES += \
$$PWD/Slider.qml \
$$PWD/SliderHandle.qml \
$$PWD/SpinBox.qml \
+ $$PWD/SplitView.qml \
$$PWD/StackView.qml \
$$PWD/SwipeDelegate.qml \
$$PWD/SwipeView.qml \
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 754e76ab..0dd787b4 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -56,6 +56,7 @@
#include <QtQuickControls2/private/qquicktumblerview_p.h>
#endif
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
+#include <QtQuickTemplates2/private/qquicksplitview_p.h>
#include <QtQuickControls2/private/qquickclippedtext_p.h>
#include <QtQuickControls2/private/qquickitemgroup_p.h>
#include <QtQuickTemplates2/private/qquicktheme_p_p.h>
@@ -186,6 +187,11 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterType(resolvedUrl(QStringLiteral("MenuBarItem.qml")), uri, 2, 3, "MenuBarItem");
qmlRegisterUncreatableType<QQuickOverlay>(uri, 2, 3, "Overlay", QStringLiteral("Overlay is only available as an attached property."));
+ // QtQuick.Controls 2.5 (new types in Qt 5.12)
+ qmlRegisterType(resolvedUrl(QStringLiteral("SplitView.qml")), uri, 2, 5, "SplitView");
+ qmlRegisterUncreatableType<QQuickSplitHandleAttached>(uri, 2, 5, "SplitHandle",
+ QStringLiteral("SplitHandle is only available as an attached property."));
+
const QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterModule(import, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2...
diff --git a/src/imports/controls/universal/SplitView.qml b/src/imports/controls/universal/SplitView.qml
new file mode 100644
index 00000000..bbcdba9d
--- /dev/null
+++ b/src/imports/controls/universal/SplitView.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
+
+T.SplitView {
+ id: control
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ handle: Rectangle {
+ implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width
+ implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6
+ color: T.SplitHandle.pressed ? control.Universal.baseMediumColor
+ : (T.SplitHandle.hovered ? control.Universal.baseMediumLowColor : control.Universal.chromeHighColor)
+ }
+}
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index 33d0dcb0..4440acbf 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -34,6 +34,7 @@ QML_FILES += \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
$$PWD/SpinBox.qml \
+ $$PWD/SplitView.qml \
$$PWD/StackView.qml \
$$PWD/SwipeDelegate.qml \
$$PWD/SwitchDelegate.qml \
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index ef7a646b..0d5765be 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -82,6 +82,7 @@
#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
#include <QtQuickTemplates2/private/qquickslider_p.h>
#include <QtQuickTemplates2/private/qquickspinbox_p.h>
+#include <QtQuickTemplates2/private/qquicksplitview_p.h>
#include <QtQuickTemplates2/private/qquickstackview_p.h>
#include <QtQuickTemplates2/private/qquickswipe_p.h>
#include <QtQuickTemplates2/private/qquickswipedelegate_p.h>
@@ -337,6 +338,11 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickPopupAnchors>();
qmlRegisterType<QQuickRangeSlider, 5>(uri, 2, 5, "RangeSlider");
qmlRegisterType<QQuickSlider, 5>(uri, 2, 5, "Slider");
+ qmlRegisterType<QQuickSplitView, 5>(uri, 2, 5, "SplitView");
+ qmlRegisterType<QQuickSplitViewAttached>();
+ qmlRegisterUncreatableType<QQuickSplitHandleAttached>(uri, 2, 5, "SplitHandle",
+ QStringLiteral("SplitHandle is only available as an attached property."));
+ qmlRegisterType<QQuickSplitHandleAttached>();
qmlRegisterType<QQuickSpinBox, 5>(uri, 2, 5, "SpinBox");
qmlRegisterType<QQuickTextArea, 5>(uri, 2, 5, "TextArea");
qmlRegisterType<QQuickTextField, 5>(uri, 2, 5, "TextField");