diff options
Diffstat (limited to 'src/imports')
34 files changed, 394 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 Binary files differnew file mode 100644 index 00000000..7afd3ff8 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-splitview-custom.png 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/includes/qquickicon.qdocinc b/src/imports/controls/doc/src/includes/qquickicon.qdocinc index a6ab90bb..ba7cede9 100644 --- a/src/imports/controls/doc/src/includes/qquickicon.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickicon.qdocinc @@ -38,5 +38,11 @@ The icon is tinted with the specified color, unless the color is set to \c "transparent". + +\row + \li cache + \li This property specifies whether the icon should be cached. + + The default value is true. \endtable //! [grouped-properties] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index d50e4c83..958cc358 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 Binary files differindex ecb437f7..f3535b37 100644 --- a/src/imports/controls/imagine/design/imagine.sketch +++ b/src/imports/controls/imagine/design/imagine.sketch diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled.png b/src/imports/controls/imagine/images/splitview-handle-disabled.png Binary files differnew file mode 100644 index 00000000..0071c196 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-disabled.png diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png Binary files differnew file mode 100644 index 00000000..67cee407 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-disabled@2x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png Binary files differnew file mode 100644 index 00000000..84752ba9 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-disabled@3x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png b/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png Binary files differnew file mode 100644 index 00000000..e4be8597 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-disabled@4x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered.png b/src/imports/controls/imagine/images/splitview-handle-hovered.png Binary files differnew file mode 100644 index 00000000..1386d213 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-hovered.png diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png Binary files differnew file mode 100644 index 00000000..4708a47b --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-hovered@2x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png Binary files differnew file mode 100644 index 00000000..2ccc1ff5 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-hovered@3x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png b/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png Binary files differnew file mode 100644 index 00000000..6929da70 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-hovered@4x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed.png b/src/imports/controls/imagine/images/splitview-handle-pressed.png Binary files differnew file mode 100644 index 00000000..7face6b4 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-pressed.png diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png Binary files differnew file mode 100644 index 00000000..ad940d0f --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-pressed@2x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png Binary files differnew file mode 100644 index 00000000..d4e19dc2 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-pressed@3x.png diff --git a/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png b/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png Binary files differnew file mode 100644 index 00000000..8ccbbebc --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle-pressed@4x.png diff --git a/src/imports/controls/imagine/images/splitview-handle.png b/src/imports/controls/imagine/images/splitview-handle.png Binary files differnew file mode 100644 index 00000000..c1dffa67 --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle.png diff --git a/src/imports/controls/imagine/images/splitview-handle@2x.png b/src/imports/controls/imagine/images/splitview-handle@2x.png Binary files differnew file mode 100644 index 00000000..180e266a --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle@2x.png diff --git a/src/imports/controls/imagine/images/splitview-handle@3x.png b/src/imports/controls/imagine/images/splitview-handle@3x.png Binary files differnew file mode 100644 index 00000000..35ea51db --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle@3x.png diff --git a/src/imports/controls/imagine/images/splitview-handle@4x.png b/src/imports/controls/imagine/images/splitview-handle@4x.png Binary files differnew file mode 100644 index 00000000..3a1e7e9f --- /dev/null +++ b/src/imports/controls/imagine/images/splitview-handle@4x.png 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/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 4585a9a6..6d414405 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -1282,6 +1282,7 @@ Module { Property { name: "width"; type: "int" } Property { name: "height"; type: "int" } Property { name: "color"; type: "QColor" } + Property { name: "cache"; type: "bool" } } Component { name: "QQuickItemDelegate" diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index a03cbd06..133be0d1 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> @@ -192,6 +193,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.")); + // Register the latest version, even if there are no new types or new revisions for existing types yet. // Before Qt 5.12, we would do the following: // 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 c4ff68fc..510980e3 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> @@ -343,6 +344,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"); |