diff options
Diffstat (limited to 'src/imports/controls/default')
94 files changed, 6778 insertions, 0 deletions
diff --git a/src/imports/controls/default/AbstractButton.qml b/src/imports/controls/default/AbstractButton.qml new file mode 100644 index 00000000..50ddb933 --- /dev/null +++ b/src/imports/controls/default/AbstractButton.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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.12 as T + +T.AbstractButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) +} diff --git a/src/imports/controls/default/Action.qml b/src/imports/controls/default/Action.qml new file mode 100644 index 00000000..996e9086 --- /dev/null +++ b/src/imports/controls/default/Action.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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.12 as T + +T.Action { } diff --git a/src/imports/controls/default/ActionGroup.qml b/src/imports/controls/default/ActionGroup.qml new file mode 100644 index 00000000..89e72c8f --- /dev/null +++ b/src/imports/controls/default/ActionGroup.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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.12 as T + +T.ActionGroup { } diff --git a/src/imports/controls/default/ApplicationWindow.qml b/src/imports/controls/default/ApplicationWindow.qml new file mode 100644 index 00000000..235ebf13 --- /dev/null +++ b/src/imports/controls/default/ApplicationWindow.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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.Window 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ApplicationWindow { + id: window + + color: window.palette.window +} diff --git a/src/imports/controls/default/BusyIndicator.qml b/src/imports/controls/default/BusyIndicator.qml new file mode 100644 index 00000000..ff5c191c --- /dev/null +++ b/src/imports/controls/default/BusyIndicator.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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.BusyIndicator { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + + contentItem: BusyIndicatorImpl { + implicitWidth: 48 + implicitHeight: 48 + + pen: control.palette.dark + fill: control.palette.dark + + running: control.running + opacity: control.running ? 1 : 0 + Behavior on opacity { OpacityAnimator { duration: 250 } } + } +} diff --git a/src/imports/controls/default/Button.qml b/src/imports/controls/default/Button.qml new file mode 100644 index 00000000..a9e7fce6 --- /dev/null +++ b/src/imports/controls/default/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Button { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + horizontalPadding: padding + 2 + spacing: 6 + + icon.width: 24 + icon.height: 24 + icon.color: control.checked || control.highlighted ? control.palette.brightText : + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + + icon: control.icon + text: control.text + font: control.font + color: control.checked || control.highlighted ? control.palette.brightText : + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: !control.flat || control.down || control.checked || control.highlighted + color: Color.blend(control.checked || control.highlighted ? control.palette.dark : control.palette.button, + control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight + border.width: control.visualFocus ? 2 : 0 + } +} diff --git a/src/imports/controls/default/ButtonGroup.qml b/src/imports/controls/default/ButtonGroup.qml new file mode 100644 index 00000000..cf0355ba --- /dev/null +++ b/src/imports/controls/default/ButtonGroup.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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.12 as T + +T.ButtonGroup { } diff --git a/src/imports/controls/default/CheckBox.qml b/src/imports/controls/default/CheckBox.qml new file mode 100644 index 00000000..3a7c3a06 --- /dev/null +++ b/src/imports/controls/default/CheckBox.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.CheckBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + // keep in sync with CheckDelegate.qml (shared CheckIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + + x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 + y: control.topPadding + (control.availableHeight - height) / 2 + + color: control.down ? control.palette.light : control.palette.base + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid + + ColorImage { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + defaultColor: "#353637" + color: control.palette.text + source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/check.png" + visible: control.checkState === Qt.Checked + } + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 16 + height: 3 + color: control.palette.text + visible: control.checkState === Qt.PartiallyChecked + } + } + + contentItem: CheckLabel { + leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 + + text: control.text + font: control.font + color: control.palette.windowText + } +} diff --git a/src/imports/controls/default/CheckDelegate.qml b/src/imports/controls/default/CheckDelegate.qml new file mode 100644 index 00000000..4dec9b98 --- /dev/null +++ b/src/imports/controls/default/CheckDelegate.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.CheckDelegate { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 12 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.text + + contentItem: IconLabel { + leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0 + + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.text + } + + // keep in sync with CheckBox.qml (shared CheckIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + + x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + + color: control.down ? control.palette.light : control.palette.base + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid + + ColorImage { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + defaultColor: "#353637" + color: control.palette.text + source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/check.png" + visible: control.checkState === Qt.Checked + } + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 16 + height: 3 + color: control.palette.text + visible: control.checkState === Qt.PartiallyChecked + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? control.palette.midlight : control.palette.light + } +} diff --git a/src/imports/controls/default/ComboBox.qml b/src/imports/controls/default/ComboBox.qml new file mode 100644 index 00000000..2c36aac6 --- /dev/null +++ b/src/imports/controls/default/ComboBox.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** 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.15 +import QtQuick.Window 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Controls.impl 2.15 +import QtQuick.Templates 2.15 as T + +T.ComboBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) + rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) + + delegate: ItemDelegate { + width: ListView.view.width + text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData + palette.text: control.palette.text + palette.highlightedText: control.palette.highlightedText + font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal + highlighted: control.highlightedIndex === index + hoverEnabled: control.hoverEnabled + } + + indicator: ColorImage { + x: control.mirrored ? control.padding : control.width - width - control.padding + y: control.topPadding + (control.availableHeight - height) / 2 + color: control.palette.dark + defaultColor: "#353637" + source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/double-arrow.png" + opacity: enabled ? 1 : 0.3 + } + + contentItem: T.TextField { + leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 + rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 + topPadding: 6 - control.padding + bottomPadding: 6 - control.padding + + text: control.editable ? control.editText : control.displayText + + enabled: control.editable + autoScroll: control.editable + readOnly: control.down + inputMethodHints: control.inputMethodHints + validator: control.validator + selectByMouse: control.selectTextByMouse + + font: control.font + color: control.editable ? control.palette.text : control.palette.buttonText + selectionColor: control.palette.highlight + selectedTextColor: control.palette.highlightedText + verticalAlignment: Text.AlignVCenter + + background: Rectangle { + visible: control.enabled && control.editable && !control.flat + border.width: parent && parent.activeFocus ? 2 : 1 + border.color: parent && parent.activeFocus ? control.palette.highlight : control.palette.button + color: control.palette.base + } + } + + background: Rectangle { + implicitWidth: 140 + implicitHeight: 40 + + color: control.down ? control.palette.mid : control.palette.button + border.color: control.palette.highlight + border.width: !control.editable && control.visualFocus ? 2 : 0 + visible: !control.flat || control.down + } + + popup: T.Popup { + y: control.height + width: control.width + height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) + topMargin: 6 + bottomMargin: 6 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.delegateModel + currentIndex: control.highlightedIndex + highlightMoveDuration: 0 + + Rectangle { + z: 10 + width: parent.width + height: parent.height + color: "transparent" + border.color: control.palette.mid + } + + T.ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: control.palette.window + } + } +} diff --git a/src/imports/controls/default/Container.qml b/src/imports/controls/default/Container.qml new file mode 100644 index 00000000..83ab957d --- /dev/null +++ b/src/imports/controls/default/Container.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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.12 as T + +T.Container { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) +} diff --git a/src/imports/controls/default/Control.qml b/src/imports/controls/default/Control.qml new file mode 100644 index 00000000..a963a563 --- /dev/null +++ b/src/imports/controls/default/Control.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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.12 as T + +T.Control { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) +} diff --git a/src/imports/controls/default/DelayButton.qml b/src/imports/controls/default/DelayButton.qml new file mode 100644 index 00000000..1c545a71 --- /dev/null +++ b/src/imports/controls/default/DelayButton.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.DelayButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + horizontalPadding: padding + 2 + + transition: Transition { + NumberAnimation { + duration: control.delay * (control.pressed ? 1.0 - control.progress : 0.3 * control.progress) + } + } + + contentItem: ItemGroup { + ClippedText { + clip: control.progress > 0 + clipX: -control.leftPadding + control.progress * control.width + clipWidth: (1.0 - control.progress) * control.width + visible: control.progress < 1 + + text: control.text + font: control.font + opacity: enabled ? 1 : 0.3 + color: control.palette.buttonText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + ClippedText { + clip: control.progress > 0 + clipX: -control.leftPadding + clipWidth: control.progress * control.width + visible: control.progress > 0 + + text: control.text + font: control.font + opacity: enabled ? 1 : 0.3 + color: control.palette.brightText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + color: Color.blend(control.palette.button, control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight + border.width: control.visualFocus ? 2 : 0 + + PaddedRectangle { + padding: control.visualFocus ? 2 : 0 + width: control.progress * parent.width + height: parent.height + color: Color.blend(control.palette.dark, control.palette.mid, control.down ? 0.5 : 0.0) + } + } +} diff --git a/src/imports/controls/default/Dial.qml b/src/imports/controls/default/Dial.qml new file mode 100644 index 00000000..457016d3 --- /dev/null +++ b/src/imports/controls/default/Dial.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Dial { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + background: DialImpl { + implicitWidth: 184 + implicitHeight: 184 + color: control.visualFocus ? control.palette.highlight : control.palette.dark + progress: control.position + opacity: control.enabled ? 1 : 0.3 + } + + handle: ColorImage { + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 + width: 14 + height: 10 + defaultColor: "#353637" + color: control.visualFocus ? control.palette.highlight : control.palette.dark + source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/dial-indicator.png" + antialiasing: true + opacity: control.enabled ? 1 : 0.3 + transform: [ + Translate { + y: -Math.min(control.background.width, control.background.height) * 0.4 + control.handle.height / 2 + }, + Rotation { + angle: control.angle + origin.x: control.handle.width / 2 + origin.y: control.handle.height / 2 + } + ] + } +} diff --git a/src/imports/controls/default/Dialog.qml b/src/imports/controls/default/Dialog.qml new file mode 100644 index 00000000..6c2e4b1b --- /dev/null +++ b/src/imports/controls/default/Dialog.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.Dialog { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding, + implicitHeaderWidth, + implicitFooterWidth) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding + + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) + + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) + + padding: 12 + + background: Rectangle { + color: control.palette.window + border.color: control.palette.dark + } + + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + font.bold: true + padding: 12 + background: Rectangle { + x: 1; y: 1 + width: parent.width - 2 + height: parent.height - 1 + color: control.palette.window + } + } + + footer: DialogButtonBox { + visible: count > 0 + } + + T.Overlay.modal: Rectangle { + color: Color.transparent(control.palette.shadow, 0.5) + } + + T.Overlay.modeless: Rectangle { + color: Color.transparent(control.palette.shadow, 0.12) + } +} diff --git a/src/imports/controls/default/DialogButtonBox.qml b/src/imports/controls/default/DialogButtonBox.qml new file mode 100644 index 00000000..3c9d5b48 --- /dev/null +++ b/src/imports/controls/default/DialogButtonBox.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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.12 as T + +T.DialogButtonBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + (control.count === 1 ? implicitContentWidth * 2 : implicitContentWidth) + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + contentWidth: contentItem.contentWidth + + spacing: 1 + padding: 12 + alignment: count === 1 ? Qt.AlignRight : undefined + + delegate: Button { + width: control.count === 1 ? control.availableWidth / 2 : undefined + } + + contentItem: ListView { + model: control.contentModel + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + } + + background: Rectangle { + implicitHeight: 40 + x: 1; y: 1 + width: parent.width - 2 + height: parent.height - 2 + color: control.palette.window + } +} diff --git a/src/imports/controls/default/Drawer.qml b/src/imports/controls/default/Drawer.qml new file mode 100644 index 00000000..17465fd4 --- /dev/null +++ b/src/imports/controls/default/Drawer.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Drawer { + id: control + + parent: T.Overlay.overlay + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + topPadding: control.edge === Qt.BottomEdge + leftPadding: control.edge === Qt.RightEdge + rightPadding: control.edge === Qt.LeftEdge + bottomPadding: control.edge === Qt.TopEdge + + enter: Transition { SmoothedAnimation { velocity: 5 } } + exit: Transition { SmoothedAnimation { velocity: 5 } } + + background: Rectangle { + color: control.palette.window + Rectangle { + readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge + width: horizontal ? 1 : parent.width + height: horizontal ? parent.height : 1 + color: control.palette.dark + x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 + y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 + } + } + + T.Overlay.modal: Rectangle { + color: Color.transparent(control.palette.shadow, 0.5) + } + + T.Overlay.modeless: Rectangle { + color: Color.transparent(control.palette.shadow, 0.12) + } +} diff --git a/src/imports/controls/default/Frame.qml b/src/imports/controls/default/Frame.qml new file mode 100644 index 00000000..2fe46104 --- /dev/null +++ b/src/imports/controls/default/Frame.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Frame { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + padding: 12 + + background: Rectangle { + color: "transparent" + border.color: control.palette.mid + } +} diff --git a/src/imports/controls/default/GroupBox.qml b/src/imports/controls/default/GroupBox.qml new file mode 100644 index 00000000..96f776f2 --- /dev/null +++ b/src/imports/controls/default/GroupBox.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.GroupBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding, + implicitLabelWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + spacing: 6 + padding: 12 + topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0) + + label: Text { + x: control.leftPadding + width: control.availableWidth + + text: control.title + font: control.font + color: control.palette.windowText + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle { + y: control.topPadding - control.bottomPadding + width: parent.width + height: parent.height - control.topPadding + control.bottomPadding + + color: "transparent" + border.color: control.palette.mid + } +} diff --git a/src/imports/controls/default/HorizontalHeaderView.qml b/src/imports/controls/default/HorizontalHeaderView.qml new file mode 100644 index 00000000..ec91af25 --- /dev/null +++ b/src/imports/controls/default/HorizontalHeaderView.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.HorizontalHeaderView { + id: control + + implicitWidth: syncView ? syncView.width : 0 + implicitHeight: contentHeight + + delegate: Rectangle { + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: text.implicitWidth + (cellPadding * 2) + implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + id: text + text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] + : model[control.textRole]) + : modelData + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/default/ItemDelegate.qml b/src/imports/controls/default/ItemDelegate.qml new file mode 100644 index 00000000..6229e2bb --- /dev/null +++ b/src/imports/controls/default/ItemDelegate.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ItemDelegate { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 8 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.text + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.highlighted ? control.palette.highlightedText : control.palette.text + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted || control.visualFocus + color: Color.blend(control.down ? control.palette.midlight : control.palette.light, + control.palette.highlight, control.visualFocus ? 0.15 : 0.0) + } +} diff --git a/src/imports/controls/default/Label.qml b/src/imports/controls/default/Label.qml new file mode 100644 index 00000000..9a42635f --- /dev/null +++ b/src/imports/controls/default/Label.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Label { + id: control + + color: control.palette.windowText + linkColor: control.palette.link +} diff --git a/src/imports/controls/default/Menu.qml b/src/imports/controls/default/Menu.qml new file mode 100644 index 00000000..cf3a52f2 --- /dev/null +++ b/src/imports/controls/default/Menu.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T +import QtQuick.Window 2.12 + +T.Menu { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + margins: 0 + overlap: 1 + + delegate: MenuItem { } + + contentItem: ListView { + implicitHeight: contentHeight + model: control.contentModel + interactive: Window.window + ? contentHeight + control.topPadding + control.bottomPadding > Window.window.height + : false + clip: true + currentIndex: control.currentIndex + + ScrollIndicator.vertical: ScrollIndicator {} + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + color: control.palette.window + border.color: control.palette.dark + } + + T.Overlay.modal: Rectangle { + color: Color.transparent(control.palette.shadow, 0.5) + } + + T.Overlay.modeless: Rectangle { + color: Color.transparent(control.palette.shadow, 0.12) + } +} diff --git a/src/imports/controls/default/MenuBar.qml b/src/imports/controls/default/MenuBar.qml new file mode 100644 index 00000000..122cdc53 --- /dev/null +++ b/src/imports/controls/default/MenuBar.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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.MenuBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + delegate: MenuBarItem { } + + contentItem: Row { + spacing: control.spacing + Repeater { + model: control.contentModel + } + } + + background: Rectangle { + implicitHeight: 40 + color: control.palette.button + } +} diff --git a/src/imports/controls/default/MenuBarItem.qml b/src/imports/controls/default/MenuBarItem.qml new file mode 100644 index 00000000..f6835412 --- /dev/null +++ b/src/imports/controls/default/MenuBarItem.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.MenuBarItem { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + spacing: 6 + padding: 6 + leftPadding: 12 + rightPadding: 16 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.buttonText + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.buttonText + } + + background: Rectangle { + implicitWidth: 40 + implicitHeight: 40 + color: control.down || control.highlighted ? control.palette.mid : "transparent" + } +} diff --git a/src/imports/controls/default/MenuItem.qml b/src/imports/controls/default/MenuItem.qml new file mode 100644 index 00000000..0632decb --- /dev/null +++ b/src/imports/controls/default/MenuItem.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.MenuItem { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.windowText + + contentItem: IconLabel { + readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0 + readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0 + leftPadding: !control.mirrored ? indicatorPadding : arrowPadding + rightPadding: control.mirrored ? indicatorPadding : arrowPadding + + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.windowText + } + + indicator: ColorImage { + x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding + y: control.topPadding + (control.availableHeight - height) / 2 + + visible: control.checked + source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/check.png" : "" + color: control.palette.windowText + defaultColor: "#353637" + } + + arrow: ColorImage { + x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + + visible: control.subMenu + mirror: control.mirrored + source: control.subMenu ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/Default/images/arrow-indicator.png" : "" + color: control.palette.windowText + defaultColor: "#353637" + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + x: 1 + y: 1 + width: control.width - 2 + height: control.height - 2 + color: control.down ? control.palette.midlight : control.highlighted ? control.palette.light : "transparent" + } +} diff --git a/src/imports/controls/default/MenuSeparator.qml b/src/imports/controls/default/MenuSeparator.qml new file mode 100644 index 00000000..cc5c2b6e --- /dev/null +++ b/src/imports/controls/default/MenuSeparator.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.MenuSeparator { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 2 + verticalPadding: padding + 4 + + contentItem: Rectangle { + implicitWidth: 188 + implicitHeight: 1 + color: control.palette.mid + } +} diff --git a/src/imports/controls/default/Page.qml b/src/imports/controls/default/Page.qml new file mode 100644 index 00000000..4b3cf3d2 --- /dev/null +++ b/src/imports/controls/default/Page.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Page { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding, + implicitHeaderWidth, + implicitFooterWidth) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding + + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) + + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) + + background: Rectangle { + color: control.palette.window + } +} diff --git a/src/imports/controls/default/PageIndicator.qml b/src/imports/controls/default/PageIndicator.qml new file mode 100644 index 00000000..78f9e3cf --- /dev/null +++ b/src/imports/controls/default/PageIndicator.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.PageIndicator { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + delegate: Rectangle { + implicitWidth: 8 + implicitHeight: 8 + + radius: width / 2 + color: control.palette.dark + + opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 + Behavior on opacity { OpacityAnimator { duration: 100 } } + } + + contentItem: Row { + spacing: control.spacing + + Repeater { + model: control.count + delegate: control.delegate + } + } +} diff --git a/src/imports/controls/default/Pane.qml b/src/imports/controls/default/Pane.qml new file mode 100644 index 00000000..47b916e3 --- /dev/null +++ b/src/imports/controls/default/Pane.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Pane { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + padding: 12 + + background: Rectangle { + color: control.palette.window + } +} diff --git a/src/imports/controls/default/Popup.qml b/src/imports/controls/default/Popup.qml new file mode 100644 index 00000000..ee243c10 --- /dev/null +++ b/src/imports/controls/default/Popup.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Popup { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + padding: 12 + + background: Rectangle { + color: control.palette.window + border.color: control.palette.dark + } + + T.Overlay.modal: Rectangle { + color: Color.transparent(control.palette.shadow, 0.5) + } + + T.Overlay.modeless: Rectangle { + color: Color.transparent(control.palette.shadow, 0.12) + } +} diff --git a/src/imports/controls/default/ProgressBar.qml b/src/imports/controls/default/ProgressBar.qml new file mode 100644 index 00000000..61cdea43 --- /dev/null +++ b/src/imports/controls/default/ProgressBar.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.ProgressBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + contentItem: ProgressBarImpl { + implicitHeight: 6 + implicitWidth: 116 + scale: control.mirrored ? -1 : 1 + progress: control.position + indeterminate: control.visible && control.indeterminate + color: control.palette.dark + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 6 + y: (control.height - height) / 2 + height: 6 + + color: control.palette.midlight + } +} diff --git a/src/imports/controls/default/RadioButton.qml b/src/imports/controls/default/RadioButton.qml new file mode 100644 index 00000000..cdf0c30e --- /dev/null +++ b/src/imports/controls/default/RadioButton.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.RadioButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + // keep in sync with RadioDelegate.qml (shared RadioIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + + x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 + y: control.topPadding + (control.availableHeight - height) / 2 + + radius: width / 2 + color: control.down ? control.palette.light : control.palette.base + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 20 + height: 20 + radius: width / 2 + color: control.palette.text + visible: control.checked + } + } + + contentItem: CheckLabel { + leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 + + text: control.text + font: control.font + color: control.palette.windowText + } +} diff --git a/src/imports/controls/default/RadioDelegate.qml b/src/imports/controls/default/RadioDelegate.qml new file mode 100644 index 00000000..a7e7dec0 --- /dev/null +++ b/src/imports/controls/default/RadioDelegate.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.RadioDelegate { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 12 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.text + + contentItem: IconLabel { + leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0 + + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.text + } + + // keep in sync with RadioButton.qml (shared RadioIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + + x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + + radius: width / 2 + color: control.down ? control.palette.light : control.palette.base + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 20 + height: 20 + radius: width / 2 + color: control.palette.text + visible: control.checked + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? control.palette.midlight : control.palette.light + } +} diff --git a/src/imports/controls/default/RangeSlider.qml b/src/imports/controls/default/RangeSlider.qml new file mode 100644 index 00000000..c3e7c964 --- /dev/null +++ b/src/imports/controls/default/RangeSlider.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.RangeSlider { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + first.implicitHandleWidth + leftPadding + rightPadding, + second.implicitHandleWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + first.implicitHandleHeight + topPadding + bottomPadding, + second.implicitHandleHeight + topPadding + bottomPadding) + + padding: 6 + + first.handle: Rectangle { + x: control.leftPadding + (control.horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) + y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) + implicitWidth: 28 + implicitHeight: 28 + radius: width / 2 + border.width: activeFocus ? 2 : 1 + border.color: activeFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + color: control.first.pressed ? control.palette.light : control.palette.window + } + + second.handle: Rectangle { + x: control.leftPadding + (control.horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) + y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) + implicitWidth: 28 + implicitHeight: 28 + radius: width / 2 + border.width: activeFocus ? 2 : 1 + border.color: activeFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + color: control.second.pressed ? control.palette.light : control.palette.window + } + + background: Rectangle { + x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2) + y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0) + implicitWidth: control.horizontal ? 200 : 6 + implicitHeight: control.horizontal ? 6 : 200 + width: control.horizontal ? control.availableWidth : implicitWidth + height: control.horizontal ? implicitHeight : control.availableHeight + radius: 3 + color: control.palette.midlight + scale: control.horizontal && control.mirrored ? -1 : 1 + + Rectangle { + x: control.horizontal ? control.first.position * parent.width + 3 : 0 + y: control.horizontal ? 0 : control.second.visualPosition * parent.height + 3 + width: control.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 6 : 6 + height: control.horizontal ? 6 : control.second.position * parent.height - control.first.position * parent.height - 6 + + color: control.palette.dark + } + } +} diff --git a/src/imports/controls/default/RoundButton.qml b/src/imports/controls/default/RoundButton.qml new file mode 100644 index 00000000..825d5252 --- /dev/null +++ b/src/imports/controls/default/RoundButton.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.RoundButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + icon.width: 24 + icon.height: 24 + icon.color: control.checked || control.highlighted ? control.palette.brightText : + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + + icon: control.icon + text: control.text + font: control.font + color: control.checked || control.highlighted ? control.palette.brightText : + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText + } + + background: Rectangle { + implicitWidth: 40 + implicitHeight: 40 + radius: control.radius + opacity: enabled ? 1 : 0.3 + visible: !control.flat || control.down || control.checked || control.highlighted + color: Color.blend(control.checked || control.highlighted ? control.palette.dark : control.palette.button, + control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight + border.width: control.visualFocus ? 2 : 0 + } +} diff --git a/src/imports/controls/default/ScrollBar.qml b/src/imports/controls/default/ScrollBar.qml new file mode 100644 index 00000000..0948fb1d --- /dev/null +++ b/src/imports/controls/default/ScrollBar.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ScrollBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 2 + visible: control.policy !== T.ScrollBar.AlwaysOff + minimumSize: orientation == Qt.Horizontal ? height / width : width / height + + contentItem: Rectangle { + implicitWidth: control.interactive ? 6 : 2 + implicitHeight: control.interactive ? 6 : 2 + + radius: width / 2 + color: control.pressed ? control.palette.dark : control.palette.mid + opacity: 0.0 + + states: State { + name: "active" + when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0) + PropertyChanges { target: control.contentItem; opacity: 0.75 } + } + + transitions: Transition { + from: "active" + SequentialAnimation { + PauseAnimation { duration: 450 } + NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 } + } + } + } +} diff --git a/src/imports/controls/default/ScrollIndicator.qml b/src/imports/controls/default/ScrollIndicator.qml new file mode 100644 index 00000000..795c20ee --- /dev/null +++ b/src/imports/controls/default/ScrollIndicator.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ScrollIndicator { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 2 + + contentItem: Rectangle { + implicitWidth: 2 + implicitHeight: 2 + + color: control.palette.mid + visible: control.size < 1.0 + opacity: 0.0 + + states: State { + name: "active" + when: control.active + PropertyChanges { target: control.contentItem; opacity: 0.75 } + } + + transitions: [ + Transition { + from: "active" + SequentialAnimation { + PauseAnimation { duration: 450 } + NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 } + } + } + ] + } +} diff --git a/src/imports/controls/default/ScrollView.qml b/src/imports/controls/default/ScrollView.qml new file mode 100644 index 00000000..f775d624 --- /dev/null +++ b/src/imports/controls/default/ScrollView.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ScrollView { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + ScrollBar.vertical: ScrollBar { + parent: control + x: control.mirrored ? 0 : control.width - width + y: control.topPadding + height: control.availableHeight + active: control.ScrollBar.horizontal.active + } + + ScrollBar.horizontal: ScrollBar { + parent: control + x: control.leftPadding + y: control.height - height + width: control.availableWidth + active: control.ScrollBar.vertical.active + } +} diff --git a/src/imports/controls/default/Slider.qml b/src/imports/controls/default/Slider.qml new file mode 100644 index 00000000..6d532389 --- /dev/null +++ b/src/imports/controls/default/Slider.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Slider { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitHandleWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitHandleHeight + topPadding + bottomPadding) + + padding: 6 + + handle: Rectangle { + x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) + y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) + implicitWidth: 28 + implicitHeight: 28 + radius: width / 2 + color: control.pressed ? control.palette.light : control.palette.window + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + } + + background: Rectangle { + x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2) + y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0) + implicitWidth: control.horizontal ? 200 : 6 + implicitHeight: control.horizontal ? 6 : 200 + width: control.horizontal ? control.availableWidth : implicitWidth + height: control.horizontal ? implicitHeight : control.availableHeight + radius: 3 + color: control.palette.midlight + scale: control.horizontal && control.mirrored ? -1 : 1 + + Rectangle { + y: control.horizontal ? 0 : control.visualPosition * parent.height + width: control.horizontal ? control.position * parent.width : 6 + height: control.horizontal ? 6 : control.position * parent.height + + radius: 3 + color: control.palette.dark + } + } +} diff --git a/src/imports/controls/default/SpinBox.qml b/src/imports/controls/default/SpinBox.qml new file mode 100644 index 00000000..d1c2ea5b --- /dev/null +++ b/src/imports/controls/default/SpinBox.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.SpinBox { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentItem.implicitWidth + 2 * padding + + up.implicitIndicatorWidth + + down.implicitIndicatorWidth) + implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding, + implicitBackgroundHeight, + up.implicitIndicatorHeight, + down.implicitIndicatorHeight) + + padding: 6 + leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0)) + rightPadding: padding + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0)) + + validator: IntValidator { + locale: control.locale.name + bottom: Math.min(control.from, control.to) + top: Math.max(control.from, control.to) + } + + contentItem: TextInput { + z: 2 + text: control.displayText + + font: control.font + color: control.palette.text + selectionColor: control.palette.highlight + selectedTextColor: control.palette.highlightedText + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + readOnly: !control.editable + validator: control.validator + inputMethodHints: control.inputMethodHints + + Rectangle { + x: -6 - (control.down.indicator ? 1 : 0) + y: -6 + width: control.width - (control.up.indicator ? control.up.indicator.width - 1 : 0) - (control.down.indicator ? control.down.indicator.width - 1 : 0) + height: control.height + visible: control.activeFocus + color: "transparent" + border.color: control.palette.highlight + border.width: 2 + } + } + + up.indicator: Rectangle { + x: control.mirrored ? 0 : parent.width - width + height: parent.height + implicitWidth: 40 + implicitHeight: 40 + color: control.up.pressed ? control.palette.mid : control.palette.button + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: parent.width / 3 + height: 2 + color: enabled ? control.palette.buttonText : control.palette.mid + } + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 2 + height: parent.width / 3 + color: enabled ? control.palette.buttonText : control.palette.mid + } + } + + down.indicator: Rectangle { + x: control.mirrored ? parent.width - width : 0 + height: parent.height + implicitWidth: 40 + implicitHeight: 40 + color: control.down.pressed ? control.palette.mid : control.palette.button + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: parent.width / 3 + height: 2 + color: enabled ? control.palette.buttonText : control.palette.mid + } + } + + background: Rectangle { + implicitWidth: 140 + color: enabled ? control.palette.base : control.palette.button + border.color: control.palette.button + } +} diff --git a/src/imports/controls/default/SplitView.qml b/src/imports/controls/default/SplitView.qml new file mode 100644 index 00000000..9d37a83e --- /dev/null +++ b/src/imports/controls/default/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.13 +import QtQuick.Templates 2.13 as T +import QtQuick.Controls 2.13 +import QtQuick.Controls.impl 2.13 + +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/default/StackView.qml b/src/imports/controls/default/StackView.qml new file mode 100644 index 00000000..3e416b87 --- /dev/null +++ b/src/imports/controls/default/StackView.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Templates 2.12 as T + +T.StackView { + id: control + + popEnter: Transition { + XAnimator { from: (control.mirrored ? -1 : 1) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } + } + + popExit: Transition { + XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * control.width; duration: 400; easing.type: Easing.OutCubic } + } + + pushEnter: Transition { + XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } + } + + pushExit: Transition { + XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic } + } + + replaceEnter: Transition { + XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } + } + + replaceExit: Transition { + XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic } + } +} diff --git a/src/imports/controls/default/SwipeDelegate.qml b/src/imports/controls/default/SwipeDelegate.qml new file mode 100644 index 00000000..37d66bb6 --- /dev/null +++ b/src/imports/controls/default/SwipeDelegate.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.SwipeDelegate { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 12 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.text + + swipe.transition: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } } + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.text + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + color: Color.blend(control.down ? control.palette.midlight : control.palette.light, + control.palette.highlight, control.visualFocus ? 0.15 : 0.0) + } +} diff --git a/src/imports/controls/default/SwipeView.qml b/src/imports/controls/default/SwipeView.qml new file mode 100644 index 00000000..7722d258 --- /dev/null +++ b/src/imports/controls/default/SwipeView.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Templates 2.12 as T + +T.SwipeView { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + contentItem: ListView { + model: control.contentModel + interactive: control.interactive + currentIndex: control.currentIndex + focus: control.focus + + spacing: control.spacing + orientation: control.orientation + snapMode: ListView.SnapOneItem + boundsBehavior: Flickable.StopAtBounds + + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightMoveDuration: 250 + maximumFlickVelocity: 4 * (control.orientation === Qt.Horizontal ? width : height) + } +} diff --git a/src/imports/controls/default/Switch.qml b/src/imports/controls/default/Switch.qml new file mode 100644 index 00000000..f62e2502 --- /dev/null +++ b/src/imports/controls/default/Switch.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.Switch { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + indicator: PaddedRectangle { + implicitWidth: 56 + implicitHeight: 28 + + x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 + y: control.topPadding + (control.availableHeight - height) / 2 + + radius: 8 + leftPadding: 0 + rightPadding: 0 + padding: (height - 16) / 2 + color: control.checked ? control.palette.dark : control.palette.midlight + + Rectangle { + x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2))) + y: (parent.height - height) / 2 + width: 28 + height: 28 + radius: 16 + color: control.down ? control.palette.light : control.palette.window + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + + Behavior on x { + enabled: !control.down + SmoothedAnimation { velocity: 200 } + } + } + } + + contentItem: CheckLabel { + leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 + + text: control.text + font: control.font + color: control.palette.windowText + } +} diff --git a/src/imports/controls/default/SwitchDelegate.qml b/src/imports/controls/default/SwitchDelegate.qml new file mode 100644 index 00000000..d6447e77 --- /dev/null +++ b/src/imports/controls/default/SwitchDelegate.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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.12 as T +import QtQuick.Controls 2.12 +import QtQuick.Controls.impl 2.12 + +T.SwitchDelegate { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 12 + + icon.width: 24 + icon.height: 24 + icon.color: control.palette.text + + indicator: PaddedRectangle { + implicitWidth: 56 + implicitHeight: 28 + + x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 + y: control.topPadding + (control.availableHeight - height) / 2 + + radius: 8 + leftPadding: 0 + rightPadding: 0 + padding: (height - 16) / 2 + color: control.checked ? control.palette.dark : control.palette.midlight + + Rectangle { + x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2))) + y: (parent.height - height) / 2 + width: 28 + height: 28 + radius: 16 + color: control.down ? control.palette.light : control.palette.window + border.width: control.visualFocus ? 2 : 1 + border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + + Behavior on x { + enabled: !control.down + SmoothedAnimation { velocity: 200 } + } + } + } + + contentItem: IconLabel { + leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0 + + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft + + icon: control.icon + text: control.text + font: control.font + color: control.palette.text + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? control.palette.midlight : control.palette.light + } +} diff --git a/src/imports/controls/default/TabBar.qml b/src/imports/controls/default/TabBar.qml new file mode 100644 index 00000000..83f6b3b2 --- /dev/null +++ b/src/imports/controls/default/TabBar.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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.12 as T + +T.TabBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + spacing: 1 + + contentItem: ListView { + model: control.contentModel + currentIndex: control.currentIndex + + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded + snapMode: ListView.SnapToItem + + highlightMoveDuration: 0 + highlightRangeMode: ListView.ApplyRange + preferredHighlightBegin: 40 + preferredHighlightEnd: width - 40 + } + + background: Rectangle { + color: control.palette.window + } +} diff --git a/src/imports/controls/default/TabButton.qml b/src/imports/controls/default/TabButton.qml new file mode 100644 index 00000000..f8b303ea --- /dev/null +++ b/src/imports/controls/default/TabButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.TabButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + icon.width: 24 + icon.height: 24 + icon.color: checked ? control.palette.windowText : control.palette.brightText + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + + icon: control.icon + text: control.text + font: control.font + color: control.checked ? control.palette.windowText : control.palette.brightText + } + + background: Rectangle { + implicitHeight: 40 + color: Color.blend(control.checked ? control.palette.window : control.palette.dark, + control.palette.mid, control.down ? 0.5 : 0.0) + } +} diff --git a/src/imports/controls/default/TextArea.qml b/src/imports/controls/default/TextArea.qml new file mode 100644 index 00000000..45790e67 --- /dev/null +++ b/src/imports/controls/default/TextArea.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.TextArea { + id: control + + implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, + implicitBackgroundWidth + leftInset + rightInset, + placeholder.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, + implicitBackgroundHeight + topInset + bottomInset, + placeholder.implicitHeight + topPadding + bottomPadding) + + padding: 6 + leftPadding: padding + 4 + + color: control.palette.text + placeholderTextColor: Color.transparent(control.color, 0.5) + selectionColor: control.palette.highlight + selectedTextColor: control.palette.highlightedText + + PlaceholderText { + id: placeholder + x: control.leftPadding + y: control.topPadding + width: control.width - (control.leftPadding + control.rightPadding) + height: control.height - (control.topPadding + control.bottomPadding) + + text: control.placeholderText + font: control.font + color: control.placeholderTextColor + verticalAlignment: control.verticalAlignment + visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) + elide: Text.ElideRight + renderType: control.renderType + } +} diff --git a/src/imports/controls/default/TextField.qml b/src/imports/controls/default/TextField.qml new file mode 100644 index 00000000..4d9cb691 --- /dev/null +++ b/src/imports/controls/default/TextField.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.TextField { + id: control + + implicitWidth: implicitBackgroundWidth + leftInset + rightInset + || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding, + placeholder.implicitHeight + topPadding + bottomPadding) + + padding: 6 + leftPadding: padding + 4 + + color: control.palette.text + selectionColor: control.palette.highlight + selectedTextColor: control.palette.highlightedText + placeholderTextColor: Color.transparent(control.color, 0.5) + verticalAlignment: TextInput.AlignVCenter + + PlaceholderText { + id: placeholder + x: control.leftPadding + y: control.topPadding + width: control.width - (control.leftPadding + control.rightPadding) + height: control.height - (control.topPadding + control.bottomPadding) + + text: control.placeholderText + font: control.font + color: control.placeholderTextColor + verticalAlignment: control.verticalAlignment + visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) + elide: Text.ElideRight + renderType: control.renderType + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + border.width: control.activeFocus ? 2 : 1 + color: control.palette.base + border.color: control.activeFocus ? control.palette.highlight : control.palette.mid + } +} diff --git a/src/imports/controls/default/ToolBar.qml b/src/imports/controls/default/ToolBar.qml new file mode 100644 index 00000000..1e07b6bf --- /dev/null +++ b/src/imports/controls/default/ToolBar.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ToolBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + background: Rectangle { + implicitHeight: 40 + color: control.palette.button + } +} diff --git a/src/imports/controls/default/ToolButton.qml b/src/imports/controls/default/ToolButton.qml new file mode 100644 index 00000000..63aaf893 --- /dev/null +++ b/src/imports/controls/default/ToolButton.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ToolButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 6 + spacing: 6 + + icon.width: 24 + icon.height: 24 + icon.color: visualFocus ? control.palette.highlight : control.palette.buttonText + + contentItem: IconLabel { + spacing: control.spacing + mirrored: control.mirrored + display: control.display + + icon: control.icon + text: control.text + font: control.font + color: control.visualFocus ? control.palette.highlight : control.palette.buttonText + } + + background: Rectangle { + implicitWidth: 40 + implicitHeight: 40 + + opacity: control.down ? 1.0 : 0.5 + color: control.down || control.checked || control.highlighted ? control.palette.mid : control.palette.button + } +} diff --git a/src/imports/controls/default/ToolSeparator.qml b/src/imports/controls/default/ToolSeparator.qml new file mode 100644 index 00000000..188d0758 --- /dev/null +++ b/src/imports/controls/default/ToolSeparator.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ToolSeparator { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: vertical ? 6 : 2 + verticalPadding: vertical ? 2 : 6 + + contentItem: Rectangle { + implicitWidth: vertical ? 1 : 30 + implicitHeight: vertical ? 30 : 1 + color: control.palette.mid + } +} diff --git a/src/imports/controls/default/ToolTip.qml b/src/imports/controls/default/ToolTip.qml new file mode 100644 index 00000000..e0389903 --- /dev/null +++ b/src/imports/controls/default/ToolTip.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.ToolTip { + id: control + + x: parent ? (parent.width - implicitWidth) / 2 : 0 + y: -implicitHeight - 3 + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + margins: 6 + padding: 6 + + closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent + + contentItem: Text { + text: control.text + font: control.font + wrapMode: Text.Wrap + color: control.palette.toolTipText + } + + background: Rectangle { + border.color: control.palette.dark + color: control.palette.toolTipBase + } +} diff --git a/src/imports/controls/default/Tumbler.qml b/src/imports/controls/default/Tumbler.qml new file mode 100644 index 00000000..4d1abdd3 --- /dev/null +++ b/src/imports/controls/default/Tumbler.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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.Controls 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T + +T.Tumbler { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + delegate: Text { + text: modelData + color: control.visualFocus ? control.palette.highlight : control.palette.text + font: control.font + opacity: 1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + contentItem: TumblerView { + implicitWidth: 60 + implicitHeight: 200 + model: control.model + delegate: control.delegate + path: Path { + startX: control.contentItem.width / 2 + startY: -control.contentItem.delegateHeight / 2 + PathLine { + x: control.contentItem.width / 2 + y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2 + } + } + + property real delegateHeight: control.availableHeight / control.visibleItemCount + } +} diff --git a/src/imports/controls/default/VerticalHeaderView.qml b/src/imports/controls/default/VerticalHeaderView.qml new file mode 100644 index 00000000..3fc9ca5a --- /dev/null +++ b/src/imports/controls/default/VerticalHeaderView.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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.15 +import QtQuick.Controls 2.15 +import QtQuick.Templates 2.15 as T + +T.VerticalHeaderView { + id: control + + implicitWidth: contentWidth + implicitHeight: syncView ? syncView.height : 0 + + delegate: Rectangle { + // Qt6: add cellPadding (and font etc) as public API in headerview + readonly property real cellPadding: 8 + + implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) + implicitHeight: text.implicitHeight + (cellPadding * 2) + color: "#f6f6f6" + border.color: "#e4e4e4" + + Text { + id: text + text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] + : model[control.textRole]) + : modelData + width: parent.width + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: "#ff26282a" + } + } +} diff --git a/src/imports/controls/default/default.pri b/src/imports/controls/default/default.pri new file mode 100644 index 00000000..03fc0f4b --- /dev/null +++ b/src/imports/controls/default/default.pri @@ -0,0 +1,72 @@ +HEADERS += \ + $$PWD/qquickdefaultbusyindicator_p.h \ + $$PWD/qquickdefaultdial_p.h \ + $$PWD/qquickdefaultprogressbar_p.h \ + $$PWD/qquickdefaultstyle_p.h \ + $$PWD/qquickdefaulttheme_p.h + +SOURCES += \ + $$PWD/qquickdefaultbusyindicator.cpp \ + $$PWD/qquickdefaultdial.cpp \ + $$PWD/qquickdefaultprogressbar.cpp \ + $$PWD/qquickdefaultstyle.cpp \ + $$PWD/qquickdefaulttheme.cpp + +QML_FILES += \ + $$PWD/AbstractButton.qml \ + $$PWD/Action.qml \ + $$PWD/ActionGroup.qml \ + $$PWD/ApplicationWindow.qml \ + $$PWD/BusyIndicator.qml \ + $$PWD/Button.qml \ + $$PWD/ButtonGroup.qml \ + $$PWD/CheckBox.qml \ + $$PWD/CheckDelegate.qml \ + $$PWD/ComboBox.qml \ + $$PWD/Container.qml \ + $$PWD/Control.qml \ + $$PWD/DelayButton.qml \ + $$PWD/Dial.qml \ + $$PWD/Dialog.qml \ + $$PWD/DialogButtonBox.qml \ + $$PWD/Drawer.qml \ + $$PWD/Frame.qml \ + $$PWD/GroupBox.qml \ + $$PWD/HorizontalHeaderView.qml \ + $$PWD/ItemDelegate.qml \ + $$PWD/Label.qml \ + $$PWD/Menu.qml \ + $$PWD/MenuBar.qml \ + $$PWD/MenuBarItem.qml \ + $$PWD/MenuItem.qml \ + $$PWD/MenuSeparator.qml \ + $$PWD/Page.qml \ + $$PWD/PageIndicator.qml \ + $$PWD/Pane.qml \ + $$PWD/Popup.qml \ + $$PWD/ProgressBar.qml \ + $$PWD/RadioButton.qml \ + $$PWD/RadioDelegate.qml \ + $$PWD/RangeSlider.qml \ + $$PWD/RoundButton.qml \ + $$PWD/ScrollBar.qml \ + $$PWD/ScrollIndicator.qml \ + $$PWD/ScrollView.qml \ + $$PWD/Slider.qml \ + $$PWD/SpinBox.qml \ + $$PWD/SplitView.qml \ + $$PWD/StackView.qml \ + $$PWD/SwipeDelegate.qml \ + $$PWD/Switch.qml \ + $$PWD/SwitchDelegate.qml \ + $$PWD/SwipeView.qml \ + $$PWD/TabBar.qml \ + $$PWD/TabButton.qml \ + $$PWD/TextArea.qml \ + $$PWD/TextField.qml \ + $$PWD/ToolBar.qml \ + $$PWD/ToolButton.qml \ + $$PWD/ToolSeparator.qml \ + $$PWD/ToolTip.qml \ + $$PWD/Tumbler.qml \ + $$PWD/VerticalHeaderView.qml diff --git a/src/imports/controls/default/default.pro b/src/imports/controls/default/default.pro new file mode 100644 index 00000000..46e46531 --- /dev/null +++ b/src/imports/controls/default/default.pro @@ -0,0 +1,27 @@ +TARGET = qtquickcontrols2defaultstyleplugin +TARGETPATH = QtQuick/Controls.2/Default + +IMPORT_NAME = QtQuick.Controls.Default +IMPORT_VERSION = 2.$$QT_MINOR_VERSION + +QT += qml quick +QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private + +DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII + +include(default.pri) + +OTHER_FILES += \ + qmldir \ + $$QML_FILES + +SOURCES += \ + $$PWD/qtquickcontrols2defaultstyleplugin.cpp + +RESOURCES += \ + $$PWD/qtquickcontrols2defaultstyleplugin.qrc + +CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler +load(qml_plugin) + +requires(qtConfig(quickcontrols2-default)) diff --git a/src/imports/controls/default/dependencies.json b/src/imports/controls/default/dependencies.json new file mode 100644 index 00000000..78029004 --- /dev/null +++ b/src/imports/controls/default/dependencies.json @@ -0,0 +1,17 @@ +[ + { + "name": "QtQuick", + "type": "module", + "version": "2.11" + }, + { + "name": "QtQuick.Window", + "type": "module", + "version": "2.2" + }, + { + "name": "QtQuick.Templates", + "type": "module", + "version": "2.5" + } +] diff --git a/src/imports/controls/default/images/arrow-indicator.png b/src/imports/controls/default/images/arrow-indicator.png Binary files differnew file mode 100644 index 00000000..d833d52c --- /dev/null +++ b/src/imports/controls/default/images/arrow-indicator.png diff --git a/src/imports/controls/default/images/arrow-indicator@2x.png b/src/imports/controls/default/images/arrow-indicator@2x.png Binary files differnew file mode 100644 index 00000000..55c7940a --- /dev/null +++ b/src/imports/controls/default/images/arrow-indicator@2x.png diff --git a/src/imports/controls/default/images/arrow-indicator@3x.png b/src/imports/controls/default/images/arrow-indicator@3x.png Binary files differnew file mode 100644 index 00000000..c7067c5c --- /dev/null +++ b/src/imports/controls/default/images/arrow-indicator@3x.png diff --git a/src/imports/controls/default/images/arrow-indicator@4x.png b/src/imports/controls/default/images/arrow-indicator@4x.png Binary files differnew file mode 100644 index 00000000..4c5cf351 --- /dev/null +++ b/src/imports/controls/default/images/arrow-indicator@4x.png diff --git a/src/imports/controls/default/images/check.png b/src/imports/controls/default/images/check.png Binary files differnew file mode 100644 index 00000000..479a8442 --- /dev/null +++ b/src/imports/controls/default/images/check.png diff --git a/src/imports/controls/default/images/check@2x.png b/src/imports/controls/default/images/check@2x.png Binary files differnew file mode 100644 index 00000000..79663c0b --- /dev/null +++ b/src/imports/controls/default/images/check@2x.png diff --git a/src/imports/controls/default/images/check@3x.png b/src/imports/controls/default/images/check@3x.png Binary files differnew file mode 100644 index 00000000..fd0135ab --- /dev/null +++ b/src/imports/controls/default/images/check@3x.png diff --git a/src/imports/controls/default/images/check@4x.png b/src/imports/controls/default/images/check@4x.png Binary files differnew file mode 100644 index 00000000..e7e0b640 --- /dev/null +++ b/src/imports/controls/default/images/check@4x.png diff --git a/src/imports/controls/default/images/dial-indicator.png b/src/imports/controls/default/images/dial-indicator.png Binary files differnew file mode 100644 index 00000000..92357c51 --- /dev/null +++ b/src/imports/controls/default/images/dial-indicator.png diff --git a/src/imports/controls/default/images/dial-indicator@2x.png b/src/imports/controls/default/images/dial-indicator@2x.png Binary files differnew file mode 100644 index 00000000..f436443b --- /dev/null +++ b/src/imports/controls/default/images/dial-indicator@2x.png diff --git a/src/imports/controls/default/images/dial-indicator@3x.png b/src/imports/controls/default/images/dial-indicator@3x.png Binary files differnew file mode 100644 index 00000000..d883045b --- /dev/null +++ b/src/imports/controls/default/images/dial-indicator@3x.png diff --git a/src/imports/controls/default/images/dial-indicator@4x.png b/src/imports/controls/default/images/dial-indicator@4x.png Binary files differnew file mode 100644 index 00000000..79477712 --- /dev/null +++ b/src/imports/controls/default/images/dial-indicator@4x.png diff --git a/src/imports/controls/default/images/double-arrow.png b/src/imports/controls/default/images/double-arrow.png Binary files differnew file mode 100644 index 00000000..3ecd7f89 --- /dev/null +++ b/src/imports/controls/default/images/double-arrow.png diff --git a/src/imports/controls/default/images/double-arrow@2x.png b/src/imports/controls/default/images/double-arrow@2x.png Binary files differnew file mode 100644 index 00000000..eeb03e28 --- /dev/null +++ b/src/imports/controls/default/images/double-arrow@2x.png diff --git a/src/imports/controls/default/images/double-arrow@3x.png b/src/imports/controls/default/images/double-arrow@3x.png Binary files differnew file mode 100644 index 00000000..f0662d20 --- /dev/null +++ b/src/imports/controls/default/images/double-arrow@3x.png diff --git a/src/imports/controls/default/images/double-arrow@4x.png b/src/imports/controls/default/images/double-arrow@4x.png Binary files differnew file mode 100644 index 00000000..10891e91 --- /dev/null +++ b/src/imports/controls/default/images/double-arrow@4x.png diff --git a/src/imports/controls/default/images/drop-indicator.png b/src/imports/controls/default/images/drop-indicator.png Binary files differnew file mode 100644 index 00000000..80c1d958 --- /dev/null +++ b/src/imports/controls/default/images/drop-indicator.png diff --git a/src/imports/controls/default/images/drop-indicator@2x.png b/src/imports/controls/default/images/drop-indicator@2x.png Binary files differnew file mode 100644 index 00000000..6e0f228c --- /dev/null +++ b/src/imports/controls/default/images/drop-indicator@2x.png diff --git a/src/imports/controls/default/images/drop-indicator@3x.png b/src/imports/controls/default/images/drop-indicator@3x.png Binary files differnew file mode 100644 index 00000000..199752fb --- /dev/null +++ b/src/imports/controls/default/images/drop-indicator@3x.png diff --git a/src/imports/controls/default/images/drop-indicator@4x.png b/src/imports/controls/default/images/drop-indicator@4x.png Binary files differnew file mode 100644 index 00000000..58311fbe --- /dev/null +++ b/src/imports/controls/default/images/drop-indicator@4x.png diff --git a/src/imports/controls/default/plugins.qmltypes b/src/imports/controls/default/plugins.qmltypes new file mode 100644 index 00000000..e8212c55 --- /dev/null +++ b/src/imports/controls/default/plugins.qmltypes @@ -0,0 +1,895 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.15' + +Module { + dependencies: [ + "QtQuick 2.11", + "QtQuick.Templates 2.5", + "QtQuick.Window 2.2" + ] + Component { + name: "QQuickCheckLabel" + defaultProperty: "data" + prototype: "QQuickText" + exports: ["QtQuick.Controls.impl/CheckLabel 2.3"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickClippedText" + defaultProperty: "data" + prototype: "QQuickText" + exports: ["QtQuick.Controls.impl/ClippedText 2.2"] + exportMetaObjectRevisions: [0] + Property { name: "clipX"; type: "double" } + Property { name: "clipY"; type: "double" } + Property { name: "clipWidth"; type: "double" } + Property { name: "clipHeight"; type: "double" } + } + Component { + name: "QQuickColor" + prototype: "QObject" + exports: ["QtQuick.Controls.impl/Color 2.3"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + Method { + name: "transparent" + type: "QColor" + Parameter { name: "color"; type: "QColor" } + Parameter { name: "opacity"; type: "double" } + } + Method { + name: "blend" + type: "QColor" + Parameter { name: "a"; type: "QColor" } + Parameter { name: "b"; type: "QColor" } + Parameter { name: "factor"; type: "double" } + } + } + Component { + name: "QQuickColorImage" + defaultProperty: "data" + prototype: "QQuickImage" + exports: ["QtQuick.Controls.impl/ColorImage 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "color"; type: "QColor" } + Property { name: "defaultColor"; type: "QColor" } + } + Component { + name: "QQuickDefaultBusyIndicator" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.impl/BusyIndicatorImpl 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "pen"; type: "QColor" } + Property { name: "fill"; type: "QColor" } + Property { name: "running"; type: "bool" } + } + Component { + name: "QQuickDefaultDial" + defaultProperty: "data" + prototype: "QQuickPaintedItem" + exports: ["QtQuick.Controls.impl/DialImpl 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "progress"; type: "double" } + Property { name: "color"; type: "QColor" } + } + Component { + name: "QQuickDefaultProgressBar" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.impl/ProgressBarImpl 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "indeterminate"; type: "bool" } + Property { name: "progress"; type: "double" } + Property { name: "color"; type: "QColor" } + } + Component { + name: "QQuickDefaultStyle" + prototype: "QObject" + exports: ["QtQuick.Controls.impl/Default 2.1"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + Property { name: "backgroundColor"; type: "QColor"; isReadonly: true } + Property { name: "overlayModalColor"; type: "QColor"; isReadonly: true } + Property { name: "overlayDimColor"; type: "QColor"; isReadonly: true } + Property { name: "textColor"; type: "QColor"; isReadonly: true } + Property { name: "textDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "textLightColor"; type: "QColor"; isReadonly: true } + Property { name: "textLinkColor"; type: "QColor"; isReadonly: true } + Property { name: "textSelectionColor"; type: "QColor"; isReadonly: true } + Property { name: "textDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "textDisabledLightColor"; type: "QColor"; isReadonly: true } + Property { name: "textPlaceholderColor"; type: "QColor"; isReadonly: true } + Property { name: "focusColor"; type: "QColor"; isReadonly: true } + Property { name: "focusLightColor"; type: "QColor"; isReadonly: true } + Property { name: "focusPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedFocusColor"; type: "QColor"; isReadonly: true } + Property { name: "toolButtonColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonCheckedPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "delegateColor"; type: "QColor"; isReadonly: true } + Property { name: "delegatePressedColor"; type: "QColor"; isReadonly: true } + Property { name: "delegateFocusColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFrameColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFramePressedColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFrameDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "frameDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "frameLightColor"; type: "QColor"; isReadonly: true } + Property { name: "scrollBarColor"; type: "QColor"; isReadonly: true } + Property { name: "scrollBarPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "progressBarColor"; type: "QColor"; isReadonly: true } + Property { name: "pageIndicatorColor"; type: "QColor"; isReadonly: true } + Property { name: "separatorColor"; type: "QColor"; isReadonly: true } + Property { name: "disabledDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "disabledLightColor"; type: "QColor"; isReadonly: true } + } + Component { + name: "QQuickIconImage" + defaultProperty: "data" + prototype: "QQuickImage" + exports: ["QtQuick.Controls.impl/IconImage 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "name"; type: "string" } + Property { name: "color"; type: "QColor" } + } + Component { + name: "QQuickIconLabel" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.impl/IconLabel 2.3"] + exportMetaObjectRevisions: [0] + Enum { + name: "Display" + values: { + "IconOnly": 0, + "TextOnly": 1, + "TextBesideIcon": 2, + "TextUnderIcon": 3 + } + } + Property { name: "icon"; type: "QQuickIcon" } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "display"; type: "Display" } + Property { name: "spacing"; type: "double" } + Property { name: "mirrored"; type: "bool" } + Property { name: "alignment"; type: "Qt::Alignment" } + Property { name: "topPadding"; type: "double" } + Property { name: "leftPadding"; type: "double" } + Property { name: "rightPadding"; type: "double" } + Property { name: "bottomPadding"; type: "double" } + } + Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickItemGroup" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick.Controls.impl/ItemGroup 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickMnemonicLabel" + defaultProperty: "data" + prototype: "QQuickText" + exports: ["QtQuick.Controls.impl/MnemonicLabel 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "mnemonicVisible"; type: "bool" } + } + Component { + name: "QQuickOverlay" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls/Overlay 2.3"] + isCreatable: false + exportMetaObjectRevisions: [0] + attachedType: "QQuickOverlayAttached" + Property { name: "modal"; type: "QQmlComponent"; isPointer: true } + Property { name: "modeless"; type: "QQmlComponent"; isPointer: true } + Signal { name: "pressed" } + Signal { name: "released" } + } + Component { + name: "QQuickPaddedRectangle" + defaultProperty: "data" + prototype: "QQuickRectangle" + exports: ["QtQuick.Controls.impl/PaddedRectangle 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "padding"; type: "double" } + Property { name: "topPadding"; type: "double" } + Property { name: "leftPadding"; type: "double" } + Property { name: "rightPadding"; type: "double" } + Property { name: "bottomPadding"; type: "double" } + } + Component { + name: "QQuickPlaceholderText" + defaultProperty: "data" + prototype: "QQuickText" + exports: ["QtQuick.Controls.impl/PlaceholderText 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickSplitHandleAttached" + prototype: "QObject" + exports: ["QtQuick.Controls/SplitHandle 2.13"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "MarkdownText": 3, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Property { name: "padding"; revision: 6; type: "double" } + Property { name: "topPadding"; revision: 6; type: "double" } + Property { name: "leftPadding"; revision: 6; type: "double" } + Property { name: "rightPadding"; revision: 6; type: "double" } + Property { name: "bottomPadding"; revision: 6; type: "double" } + Property { name: "fontInfo"; revision: 9; type: "QJSValue"; isReadonly: true } + Property { name: "advance"; revision: 10; type: "QSizeF"; isReadonly: true } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "QQuickText::TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "QQuickText::TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "QQuickText::TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "contentWidth"; type: "double" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "contentHeight"; type: "double" } + } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Signal { name: "paddingChanged"; revision: 6 } + Signal { name: "topPaddingChanged"; revision: 6 } + Signal { name: "leftPaddingChanged"; revision: 6 } + Signal { name: "rightPaddingChanged"; revision: 6 } + Signal { name: "bottomPaddingChanged"; revision: 6 } + Signal { name: "fontInfoChanged"; revision: 9 } + Method { name: "doLayout" } + Method { name: "forceLayout"; revision: 9 } + Method { + name: "linkAt" + revision: 3 + type: "string" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickTumblerView" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.impl/TumblerView 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + } + Component { + prototype: "QQuickAbstractButton" + name: "QtQuick.Controls/AbstractButton 2.0" + exports: ["QtQuick.Controls/AbstractButton 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickAction" + name: "QtQuick.Controls/Action 2.3" + exports: ["QtQuick.Controls/Action 2.3"] + exportMetaObjectRevisions: [3] + isComposite: true + } + Component { + prototype: "QQuickActionGroup" + name: "QtQuick.Controls/ActionGroup 2.3" + exports: ["QtQuick.Controls/ActionGroup 2.3"] + exportMetaObjectRevisions: [3] + isComposite: true + defaultProperty: "actions" + } + Component { + prototype: "QQuickApplicationWindow" + name: "QtQuick.Controls/ApplicationWindow 2.0" + exports: ["QtQuick.Controls/ApplicationWindow 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickBusyIndicator" + name: "QtQuick.Controls/BusyIndicator 2.0" + exports: ["QtQuick.Controls/BusyIndicator 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickButton" + name: "QtQuick.Controls/Button 2.0" + exports: ["QtQuick.Controls/Button 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickButtonGroup" + name: "QtQuick.Controls/ButtonGroup 2.0" + exports: ["QtQuick.Controls/ButtonGroup 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + } + Component { + prototype: "QQuickCheckBox" + name: "QtQuick.Controls/CheckBox 2.0" + exports: ["QtQuick.Controls/CheckBox 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickCheckDelegate" + name: "QtQuick.Controls/CheckDelegate 2.0" + exports: ["QtQuick.Controls/CheckDelegate 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickComboBox" + name: "QtQuick.Controls/ComboBox 2.0" + exports: ["QtQuick.Controls/ComboBox 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickContainer" + name: "QtQuick.Controls/Container 2.0" + exports: ["QtQuick.Controls/Container 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickControl" + name: "QtQuick.Controls/Control 2.0" + exports: ["QtQuick.Controls/Control 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickDelayButton" + name: "QtQuick.Controls/DelayButton 2.2" + exports: ["QtQuick.Controls/DelayButton 2.2"] + exportMetaObjectRevisions: [2] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickDial" + name: "QtQuick.Controls/Dial 2.0" + exports: ["QtQuick.Controls/Dial 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickDialog" + name: "QtQuick.Controls/Dialog 2.1" + exports: ["QtQuick.Controls/Dialog 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickDialogButtonBox" + name: "QtQuick.Controls/DialogButtonBox 2.1" + exports: ["QtQuick.Controls/DialogButtonBox 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickDrawer" + name: "QtQuick.Controls/Drawer 2.0" + exports: ["QtQuick.Controls/Drawer 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickFrame" + name: "QtQuick.Controls/Frame 2.0" + exports: ["QtQuick.Controls/Frame 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickGroupBox" + name: "QtQuick.Controls/GroupBox 2.0" + exports: ["QtQuick.Controls/GroupBox 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickHorizontalHeaderView" + name: "QtQuick.Controls/HorizontalHeaderView 2.15" + exports: ["QtQuick.Controls/HorizontalHeaderView 2.15"] + exportMetaObjectRevisions: [15] + isComposite: true + defaultProperty: "flickableData" + } + Component { + prototype: "QQuickItemDelegate" + name: "QtQuick.Controls/ItemDelegate 2.0" + exports: ["QtQuick.Controls/ItemDelegate 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickLabel" + name: "QtQuick.Controls/Label 2.0" + exports: ["QtQuick.Controls/Label 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickMenu" + name: "QtQuick.Controls/Menu 2.0" + exports: ["QtQuick.Controls/Menu 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickMenuBar" + name: "QtQuick.Controls/MenuBar 2.3" + exports: ["QtQuick.Controls/MenuBar 2.3"] + exportMetaObjectRevisions: [3] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickMenuBarItem" + name: "QtQuick.Controls/MenuBarItem 2.3" + exports: ["QtQuick.Controls/MenuBarItem 2.3"] + exportMetaObjectRevisions: [3] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickMenuItem" + name: "QtQuick.Controls/MenuItem 2.0" + exports: ["QtQuick.Controls/MenuItem 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickMenuSeparator" + name: "QtQuick.Controls/MenuSeparator 2.1" + exports: ["QtQuick.Controls/MenuSeparator 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickPage" + name: "QtQuick.Controls/Page 2.0" + exports: ["QtQuick.Controls/Page 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickPageIndicator" + name: "QtQuick.Controls/PageIndicator 2.0" + exports: ["QtQuick.Controls/PageIndicator 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickPane" + name: "QtQuick.Controls/Pane 2.0" + exports: ["QtQuick.Controls/Pane 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickPopup" + name: "QtQuick.Controls/Popup 2.0" + exports: ["QtQuick.Controls/Popup 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickProgressBar" + name: "QtQuick.Controls/ProgressBar 2.0" + exports: ["QtQuick.Controls/ProgressBar 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickRadioButton" + name: "QtQuick.Controls/RadioButton 2.0" + exports: ["QtQuick.Controls/RadioButton 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickRadioDelegate" + name: "QtQuick.Controls/RadioDelegate 2.0" + exports: ["QtQuick.Controls/RadioDelegate 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickRangeSlider" + name: "QtQuick.Controls/RangeSlider 2.0" + exports: ["QtQuick.Controls/RangeSlider 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickRoundButton" + name: "QtQuick.Controls/RoundButton 2.1" + exports: ["QtQuick.Controls/RoundButton 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickScrollBar" + name: "QtQuick.Controls/ScrollBar 2.0" + exports: ["QtQuick.Controls/ScrollBar 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickScrollIndicator" + name: "QtQuick.Controls/ScrollIndicator 2.0" + exports: ["QtQuick.Controls/ScrollIndicator 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickScrollView" + name: "QtQuick.Controls/ScrollView 2.2" + exports: ["QtQuick.Controls/ScrollView 2.2"] + exportMetaObjectRevisions: [2] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickSlider" + name: "QtQuick.Controls/Slider 2.0" + exports: ["QtQuick.Controls/Slider 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSpinBox" + name: "QtQuick.Controls/SpinBox 2.0" + exports: ["QtQuick.Controls/SpinBox 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSplitView" + name: "QtQuick.Controls/SplitView 2.13" + exports: ["QtQuick.Controls/SplitView 2.13"] + exportMetaObjectRevisions: [13] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickStackView" + name: "QtQuick.Controls/StackView 2.0" + exports: ["QtQuick.Controls/StackView 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSwipeDelegate" + name: "QtQuick.Controls/SwipeDelegate 2.0" + exports: ["QtQuick.Controls/SwipeDelegate 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSwipeView" + name: "QtQuick.Controls/SwipeView 2.0" + exports: ["QtQuick.Controls/SwipeView 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickSwitch" + name: "QtQuick.Controls/Switch 2.0" + exports: ["QtQuick.Controls/Switch 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSwitchDelegate" + name: "QtQuick.Controls/SwitchDelegate 2.0" + exports: ["QtQuick.Controls/SwitchDelegate 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickTabBar" + name: "QtQuick.Controls/TabBar 2.0" + exports: ["QtQuick.Controls/TabBar 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickTabButton" + name: "QtQuick.Controls/TabButton 2.0" + exports: ["QtQuick.Controls/TabButton 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickTextArea" + name: "QtQuick.Controls/TextArea 2.0" + exports: ["QtQuick.Controls/TextArea 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickTextField" + name: "QtQuick.Controls/TextField 2.0" + exports: ["QtQuick.Controls/TextField 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickToolBar" + name: "QtQuick.Controls/ToolBar 2.0" + exports: ["QtQuick.Controls/ToolBar 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickToolButton" + name: "QtQuick.Controls/ToolButton 2.0" + exports: ["QtQuick.Controls/ToolButton 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickToolSeparator" + name: "QtQuick.Controls/ToolSeparator 2.1" + exports: ["QtQuick.Controls/ToolSeparator 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickToolTip" + name: "QtQuick.Controls/ToolTip 2.0" + exports: ["QtQuick.Controls/ToolTip 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickTumbler" + name: "QtQuick.Controls/Tumbler 2.0" + exports: ["QtQuick.Controls/Tumbler 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickVerticalHeaderView" + name: "QtQuick.Controls/VerticalHeaderView 2.15" + exports: ["QtQuick.Controls/VerticalHeaderView 2.15"] + exportMetaObjectRevisions: [15] + isComposite: true + defaultProperty: "flickableData" + } +} diff --git a/src/imports/controls/default/qmldir b/src/imports/controls/default/qmldir new file mode 100644 index 00000000..69b219aa --- /dev/null +++ b/src/imports/controls/default/qmldir @@ -0,0 +1,4 @@ +module QtQuick.Controls.Default +plugin qtquickcontrols2defaultstyleplugin +classname QtQuickControls2DefaultStylePlugin +depends QtQuick.Controls 2.5 diff --git a/src/imports/controls/default/qquickdefaultbusyindicator.cpp b/src/imports/controls/default/qquickdefaultbusyindicator.cpp new file mode 100644 index 00000000..aca795d9 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultbusyindicator.cpp @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickdefaultbusyindicator_p.h" + +#include <QtQuick/private/qquickitem_p.h> +#include <QtQuick/private/qsgadaptationlayer_p.h> +#include <QtQuickControls2/private/qquickanimatednode_p.h> + +QT_BEGIN_NAMESPACE + +static const int CircleCount = 10; +static const int TotalDuration = 100 * CircleCount * 2; +static const QRgb TransparentColor = 0x00000000; + +static QPointF moveCircle(const QPointF &pos, qreal rotation, qreal distance) +{ + return pos - QTransform().rotate(rotation).map(QPointF(0, distance)); +} + +class QQuickDefaultBusyIndicatorNode : public QQuickAnimatedNode +{ +public: + QQuickDefaultBusyIndicatorNode(QQuickDefaultBusyIndicator *item); + + void updateCurrentTime(int time) override; + void sync(QQuickItem *item) override; + +private: + QColor m_pen; + QColor m_fill; +}; + +QQuickDefaultBusyIndicatorNode::QQuickDefaultBusyIndicatorNode(QQuickDefaultBusyIndicator *item) + : QQuickAnimatedNode(item) +{ + setLoopCount(Infinite); + setDuration(TotalDuration); + setCurrentTime(item->elapsed()); + + for (int i = 0; i < CircleCount; ++i) { + QSGTransformNode *transformNode = new QSGTransformNode; + appendChildNode(transformNode); + + QQuickItemPrivate *d = QQuickItemPrivate::get(item); + QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); + rectNode->setAntialiasing(true); + transformNode->appendChildNode(rectNode); + } +} + +void QQuickDefaultBusyIndicatorNode::updateCurrentTime(int time) +{ + const qreal percentageComplete = time / qreal(TotalDuration); + const qreal firstPhaseProgress = percentageComplete <= 0.5 ? percentageComplete * 2 : 0; + const qreal secondPhaseProgress = percentageComplete > 0.5 ? (percentageComplete - 0.5) * 2 : 0; + + QSGTransformNode *transformNode = static_cast<QSGTransformNode*>(firstChild()); + Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType); + for (int i = 0; i < CircleCount; ++i) { + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild()); + Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); + + const bool fill = (firstPhaseProgress > qreal(i) / CircleCount) || (secondPhaseProgress > 0 && secondPhaseProgress < qreal(i) / CircleCount); + rectNode->setColor(fill ? m_fill : QColor::fromRgba(TransparentColor)); + rectNode->setPenColor(m_pen); + rectNode->setPenWidth(1); + rectNode->update(); + + transformNode = static_cast<QSGTransformNode*>(transformNode->nextSibling()); + } +} + +void QQuickDefaultBusyIndicatorNode::sync(QQuickItem *item) +{ + const qreal w = item->width(); + const qreal h = item->height(); + const qreal sz = qMin(w, h); + const qreal dx = (w - sz) / 2; + const qreal dy = (h - sz) / 2; + const int circleRadius = sz / 12; + + m_pen = static_cast<QQuickDefaultBusyIndicator *>(item)->pen(); + m_fill = static_cast<QQuickDefaultBusyIndicator *>(item)->fill(); + + QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(firstChild()); + for (int i = 0; i < CircleCount; ++i) { + Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType); + + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); + Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); + + QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius); + pos = moveCircle(pos, 360.0 / CircleCount * i, sz / 2 - circleRadius); + + QMatrix4x4 m; + m.translate(dx + pos.x(), dy + pos.y()); + transformNode->setMatrix(m); + + rectNode->setRect(QRectF(QPointF(), QSizeF(circleRadius * 2, circleRadius * 2))); + rectNode->setRadius(circleRadius); + + transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling()); + } +} + +QQuickDefaultBusyIndicator::QQuickDefaultBusyIndicator(QQuickItem *parent) : + QQuickItem(parent) +{ + setFlag(ItemHasContents); +} + +QColor QQuickDefaultBusyIndicator::pen() const +{ + return m_pen; +} + +void QQuickDefaultBusyIndicator::setPen(const QColor &pen) +{ + if (pen == m_pen) + return; + + m_pen = pen; + update(); +} + +QColor QQuickDefaultBusyIndicator::fill() const +{ + return m_fill; +} + +void QQuickDefaultBusyIndicator::setFill(const QColor &fill) +{ + if (fill == m_fill) + return; + + m_fill = fill; + update(); +} + +bool QQuickDefaultBusyIndicator::isRunning() const +{ + return isVisible(); +} + +void QQuickDefaultBusyIndicator::setRunning(bool running) +{ + if (running) + setVisible(true); +} + +int QQuickDefaultBusyIndicator::elapsed() const +{ + return m_elapsed; +} + +void QQuickDefaultBusyIndicator::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) +{ + QQuickItem::itemChange(change, data); + switch (change) { + case ItemOpacityHasChanged: + if (qFuzzyIsNull(data.realValue)) + setVisible(false); + break; + case ItemVisibleHasChanged: + update(); + break; + default: + break; + } +} + +QSGNode *QQuickDefaultBusyIndicator::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) +{ + QQuickDefaultBusyIndicatorNode *node = static_cast<QQuickDefaultBusyIndicatorNode *>(oldNode); + if (isRunning() && width() > 0 && height() > 0) { + if (!node) { + node = new QQuickDefaultBusyIndicatorNode(this); + node->start(); + } + node->sync(this); + } else { + m_elapsed = node ? node->currentTime() : 0; + delete node; + node = nullptr; + } + return node; +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/default/qquickdefaultbusyindicator_p.h b/src/imports/controls/default/qquickdefaultbusyindicator_p.h new file mode 100644 index 00000000..eedaf09a --- /dev/null +++ b/src/imports/controls/default/qquickdefaultbusyindicator_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTBUSYINDICATOR_P_H +#define QQUICKDEFAULTBUSYINDICATOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/qquickitem.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_NAMESPACE + +class QQuickDefaultBusyIndicator : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QColor pen READ pen WRITE setPen FINAL) + Q_PROPERTY(QColor fill READ fill WRITE setFill FINAL) + Q_PROPERTY(bool running READ isRunning WRITE setRunning) + +public: + explicit QQuickDefaultBusyIndicator(QQuickItem *parent = nullptr); + + QColor pen() const; + void setPen(const QColor &pen); + + QColor fill() const; + void setFill(const QColor &fill); + + bool isRunning() const; + void setRunning(bool running); + + int elapsed() const; + +protected: + void itemChange(ItemChange change, const ItemChangeData &data) override; + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; + +private: + int m_elapsed = 0; + QColor m_pen; + QColor m_fill; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickDefaultBusyIndicator) + +#endif // QQUICKDEFAULTBUSYINDICATOR_P_H diff --git a/src/imports/controls/default/qquickdefaultdial.cpp b/src/imports/controls/default/qquickdefaultdial.cpp new file mode 100644 index 00000000..1653def7 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultdial.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickdefaultdial_p.h" + +#include <QtCore/qmath.h> +#include <QtGui/qpainter.h> +#include <QtQuick/private/qquickitem_p.h> + +QT_BEGIN_NAMESPACE + +QQuickDefaultDial::QQuickDefaultDial(QQuickItem *parent) : + QQuickPaintedItem(parent) +{ +} + +qreal QQuickDefaultDial::progress() const +{ + return m_progress; +} + +void QQuickDefaultDial::setProgress(qreal progress) +{ + if (progress == m_progress) + return; + + m_progress = progress; + update(); +} + +QColor QQuickDefaultDial::color() const +{ + return m_color; +} + +void QQuickDefaultDial::setColor(const QColor &color) +{ + if (color == m_color) + return; + + m_color = color; + update(); +} + +void QQuickDefaultDial::paint(QPainter *painter) +{ + if (width() <= 0 || height() <= 0) + return; + + QPen pen(m_color); + pen.setWidth(8); + pen.setCapStyle(Qt::FlatCap); + painter->setPen(pen); + + const QRectF bounds = boundingRect(); + const qreal smallest = qMin(bounds.width(), bounds.height()); + QRectF rect = QRectF(pen.widthF() / 2.0 + 1, pen.widthF() / 2.0 + 1, smallest - pen.widthF() - 2, smallest - pen.widthF() - 2); + rect.moveCenter(bounds.center()); + + // Make sure the arc is aligned to whole pixels. + if (rect.x() - int(rect.x()) > 0) + rect.setX(qCeil(rect.x())); + if (rect.y() - int(rect.y()) > 0) + rect.setY(qCeil(rect.y())); + if (rect.width() - int(rect.width()) > 0) + rect.setWidth(qFloor(rect.width())); + if (rect.height() - int(rect.height()) > 0) + rect.setHeight(qFloor(rect.height())); + + painter->setRenderHint(QPainter::Antialiasing); + + const qreal startAngle = (140 + 90); + const qreal spanAngle = (m_progress * 280) * -1; + QPainterPath path; + path.arcMoveTo(rect, startAngle); + path.arcTo(rect, startAngle, spanAngle); + painter->drawPath(path); + + rect.adjust(-pen.widthF() / 2.0, -pen.widthF() / 2.0, pen.widthF() / 2.0, pen.widthF() / 2.0); + pen.setWidth(1); + painter->setPen(pen); + + path = QPainterPath(); + path.arcMoveTo(rect, 0); + path.arcTo(rect, 0, 360); + painter->drawPath(path); +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/default/qquickdefaultdial_p.h b/src/imports/controls/default/qquickdefaultdial_p.h new file mode 100644 index 00000000..73e14321 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultdial_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTDIAL_P_H +#define QQUICKDEFAULTDIAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/qcolor.h> +#include <QtQuick/qquickpainteditem.h> + +QT_BEGIN_NAMESPACE + +class QQuickDefaultDial : public QQuickPaintedItem +{ + Q_OBJECT + Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + +public: + explicit QQuickDefaultDial(QQuickItem *parent = nullptr); + + qreal progress() const; + void setProgress(qreal progress); + + QColor color() const; + void setColor(const QColor &color); + + void paint(QPainter *painter) override; + +private: + qreal m_progress = 0; + QColor m_color = Qt::black; +}; + +QT_END_NAMESPACE + +#endif // QQUICKDEFAULTDIAL_P_H diff --git a/src/imports/controls/default/qquickdefaultprogressbar.cpp b/src/imports/controls/default/qquickdefaultprogressbar.cpp new file mode 100644 index 00000000..f44065e4 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultprogressbar.cpp @@ -0,0 +1,280 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickdefaultprogressbar_p.h" + +#include <QtCore/qeasingcurve.h> +#include <QtQuick/private/qquickitem_p.h> +#include <QtQuick/private/qsgadaptationlayer_p.h> +#include <QtQuickControls2/private/qquickanimatednode_p.h> + +QT_BEGIN_NAMESPACE + +static const int Blocks = 4; +static const int BlockWidth = 16; +static const int BlockRestingSpacing = 4; +static const int BlockMovingSpacing = 48; +static const int BlockSpan = Blocks * (BlockWidth + BlockRestingSpacing) - BlockRestingSpacing; +static const int TotalDuration = 4000; +static const int SecondPhaseStart = TotalDuration * 0.4; +static const int ThirdPhaseStart = TotalDuration * 0.6; + +static inline qreal blockStartX(int blockIndex) +{ + return ((blockIndex + 1) * -BlockWidth) - (blockIndex * BlockMovingSpacing); +} + +static inline qreal blockRestX(int blockIndex, qreal availableWidth) +{ + const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2.0; + return spanRightEdgePos - (blockIndex + 1) * BlockWidth - (blockIndex * BlockRestingSpacing); +} + +static inline qreal blockEndX(int blockIndex, qreal availableWidth) +{ + return availableWidth - blockStartX(Blocks - 1 - blockIndex) - BlockWidth; +} + +class QQuickDefaultProgressBarNode : public QQuickAnimatedNode +{ +public: + QQuickDefaultProgressBarNode(QQuickDefaultProgressBar *item); + + void updateCurrentTime(int time) override; + void sync(QQuickItem *item) override; + +private: + bool m_indeterminate = false; + qreal m_pixelsPerSecond = 0; +}; + +QQuickDefaultProgressBarNode::QQuickDefaultProgressBarNode(QQuickDefaultProgressBar *item) + : QQuickAnimatedNode(item), + m_pixelsPerSecond(item->width()) +{ + setLoopCount(Infinite); + setDuration(TotalDuration); +} + +void QQuickDefaultProgressBarNode::updateCurrentTime(int time) +{ + QSGTransformNode *transformNode = static_cast<QSGTransformNode*>(firstChild()); + for (int i = 0; i < Blocks; ++i) { + Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType); + + QMatrix4x4 m; + const qreal restX = blockRestX(i, m_pixelsPerSecond); + const qreal timeInSeconds = time / 1000.0; + + if (time < SecondPhaseStart) { + // Move into the resting position for the first phase. + QEasingCurve easingCurve(QEasingCurve::InQuad); + const qreal easedCompletion = easingCurve.valueForProgress(time / qreal(SecondPhaseStart)); + const qreal distance = m_pixelsPerSecond * (easedCompletion * (SecondPhaseStart / 1000.0)); + const qreal position = blockStartX(i) + distance; + const qreal destination = restX; + m.translate(qMin(position, destination), 0); + } else if (time < ThirdPhaseStart) { + // Stay in the same position for the second phase. + m.translate(restX, 0); + } else { + // Move out of view for the third phase. + const int thirdPhaseSubKickoff = (BlockMovingSpacing / m_pixelsPerSecond) * 1000; + const int subphase = (time - ThirdPhaseStart) / thirdPhaseSubKickoff; + // If we're not at this subphase yet, don't try to animate movement, + // because it will be incorrect. + if (subphase < i) + return; + + const qreal timeSinceSecondPhase = timeInSeconds - (ThirdPhaseStart / 1000.0); + // We only want to start keeping track of time once our subphase has started, + // otherwise we move too much because we account for time that has already elapsed. + // For example, if we were 60 milliseconds into the third subphase: + // + // 0 ..... 1 ..... 2 ... + // 100 100 60 + // + // i == 0, timeSinceOurKickoff == 260 + // i == 1, timeSinceOurKickoff == 160 + // i == 2, timeSinceOurKickoff == 60 + const qreal timeSinceOurKickoff = timeSinceSecondPhase - (thirdPhaseSubKickoff / 1000.0 * i); + const qreal position = restX + (m_pixelsPerSecond * (timeSinceOurKickoff)); + const qreal destination = blockEndX(i, m_pixelsPerSecond); + m.translate(qMin(position, destination), 0); + } + + transformNode->setMatrix(m); + + transformNode = static_cast<QSGTransformNode*>(transformNode->nextSibling()); + } +} + +void QQuickDefaultProgressBarNode::sync(QQuickItem *item) +{ + QQuickDefaultProgressBar *bar = static_cast<QQuickDefaultProgressBar *>(item); + if (m_indeterminate != bar->isIndeterminate()) { + m_indeterminate = bar->isIndeterminate(); + if (m_indeterminate) + start(); + else + stop(); + } + m_pixelsPerSecond = item->width(); + + QQuickItemPrivate *d = QQuickItemPrivate::get(item); + + QMatrix4x4 m; + m.translate(0, (item->height() - item->implicitHeight()) / 2); + setMatrix(m); + + if (m_indeterminate) { + if (childCount() != Blocks) { + // This was previously a regular progress bar; remove the old nodes. + removeAllChildNodes(); + } + + QSGTransformNode *transformNode = static_cast<QSGTransformNode*>(firstChild()); + for (int i = 0; i < Blocks; ++i) { + if (!transformNode) { + transformNode = new QSGTransformNode; + appendChildNode(transformNode); + } + + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild()); + if (!rectNode) { + rectNode = d->sceneGraphContext()->createInternalRectangleNode(); + rectNode->setColor(bar->color()); + transformNode->appendChildNode(rectNode); + } + + QMatrix4x4 m; + m.translate(blockStartX(i), 0); + transformNode->setMatrix(m); + + rectNode->setRect(QRectF(QPointF(0, 0), QSizeF(BlockWidth, item->implicitHeight()))); + rectNode->update(); + + transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling()); + } + } else { + if (childCount() > 1) { + // This was previously an indeterminate progress bar; remove the old nodes. + removeAllChildNodes(); + } + + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(firstChild()); + if (!rectNode) { + rectNode = d->sceneGraphContext()->createInternalRectangleNode(); + rectNode->setColor(bar->color()); + appendChildNode(rectNode); + } + + rectNode->setRect(QRectF(QPointF(0, 0), QSizeF(bar->progress() * item->width(), item->implicitHeight()))); + rectNode->update(); + } +} + +QQuickDefaultProgressBar::QQuickDefaultProgressBar(QQuickItem *parent) : + QQuickItem(parent) +{ + setFlag(ItemHasContents); +} + +qreal QQuickDefaultProgressBar::progress() const +{ + return m_progress; +} + +void QQuickDefaultProgressBar::setProgress(qreal progress) +{ + if (progress == m_progress) + return; + + m_progress = progress; + update(); +} + +bool QQuickDefaultProgressBar::isIndeterminate() const +{ + return m_indeterminate; +} + +void QQuickDefaultProgressBar::setIndeterminate(bool indeterminate) +{ + if (indeterminate == m_indeterminate) + return; + + m_indeterminate = indeterminate; + setClip(m_indeterminate); + update(); +} + +QColor QQuickDefaultProgressBar::color() const +{ + return m_color; +} + +void QQuickDefaultProgressBar::setColor(const QColor &color) +{ + if (color == m_color) + return; + + m_color = color; + update(); +} + +void QQuickDefaultProgressBar::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) +{ + QQuickItem::itemChange(change, data); + if (change == ItemVisibleHasChanged) + update(); +} + +QSGNode *QQuickDefaultProgressBar::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) +{ + QQuickDefaultProgressBarNode *node = static_cast<QQuickDefaultProgressBarNode *>(oldNode); + if (isVisible() && width() > 0 && height() > 0) { + if (!node) + node = new QQuickDefaultProgressBarNode(this); + node->sync(this); + } else { + delete node; + node = nullptr; + } + return node; +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/default/qquickdefaultprogressbar_p.h b/src/imports/controls/default/qquickdefaultprogressbar_p.h new file mode 100644 index 00000000..241d0b3b --- /dev/null +++ b/src/imports/controls/default/qquickdefaultprogressbar_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTPROGRESSBAR_P_H +#define QQUICKDEFAULTPROGRESSBAR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/qquickitem.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_NAMESPACE + +class QQuickDefaultProgressBar : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate FINAL) + Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + +public: + explicit QQuickDefaultProgressBar(QQuickItem *parent = nullptr); + + bool isIndeterminate() const; + void setIndeterminate(bool indeterminate); + + qreal progress() const; + void setProgress(qreal progress); + + QColor color() const; + void setColor(const QColor &color); + +protected: + void itemChange(ItemChange change, const ItemChangeData &data) override; + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; + +private: + qreal m_progress = 0; + bool m_indeterminate = false; + QColor m_color; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickDefaultProgressBar) + +#endif // QQUICKDEFAULTPROGRESSBAR_P_H diff --git a/src/imports/controls/default/qquickdefaultstyle.cpp b/src/imports/controls/default/qquickdefaultstyle.cpp new file mode 100644 index 00000000..15c59798 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultstyle.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickdefaultstyle_p.h" + +QT_BEGIN_NAMESPACE + +QQuickDefaultStyle::QQuickDefaultStyle(QObject *parent) : + QObject(parent) +{ +} + +QColor QQuickDefaultStyle::backgroundColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::overlayModalColor() const +{ + return QColor::fromRgba(0x7F28282A); +} + +QColor QQuickDefaultStyle::overlayDimColor() const +{ + return QColor::fromRgba(0x1F28282A); +} + +QColor QQuickDefaultStyle::textColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::textDarkColor() const +{ + return QColor::fromRgba(0xFF26282A); +} + +QColor QQuickDefaultStyle::textLightColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::textLinkColor() const +{ + return QColor::fromRgba(0xFF45A7D7); +} + +QColor QQuickDefaultStyle::textSelectionColor() const +{ + return QColor::fromRgba(0xFFFDDD5C); +} + +QColor QQuickDefaultStyle::textDisabledColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::textDisabledLightColor() const +{ + return QColor::fromRgba(0xFFC2C2C2); +} + +QColor QQuickDefaultStyle::textPlaceholderColor() const +{ + return QColor::fromRgba(0xFF777777); +} + +QColor QQuickDefaultStyle::focusColor() const +{ + return QColor::fromRgba(0xFF0066FF); +} + +QColor QQuickDefaultStyle::focusLightColor() const +{ + return QColor::fromRgba(0xFFF0F6FF); +} + +QColor QQuickDefaultStyle::focusPressedColor() const +{ + return QColor::fromRgba(0xFFCCE0FF); +} + +QColor QQuickDefaultStyle::buttonColor() const +{ + return QColor::fromRgba(0xFFE0E0E0); +} + +QColor QQuickDefaultStyle::buttonPressedColor() const +{ + return QColor::fromRgba(0xFFD0D0D0); +} + +QColor QQuickDefaultStyle::buttonCheckedColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::buttonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::buttonCheckedFocusColor() const +{ + return QColor::fromRgba(0xFF599BFF); +} + +QColor QQuickDefaultStyle::toolButtonColor() const +{ + return QColor::fromRgba(0x33333333); +} + +QColor QQuickDefaultStyle::tabButtonColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::tabButtonPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::tabButtonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::delegateColor() const +{ + return QColor::fromRgba(0xFFEEEEEE); +} + +QColor QQuickDefaultStyle::delegatePressedColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::delegateFocusColor() const +{ + return QColor::fromRgba(0xFFE5EFFF); +} + +QColor QQuickDefaultStyle::indicatorPressedColor() const +{ + return QColor::fromRgba(0xFFF6F6F6); +} + +QColor QQuickDefaultStyle::indicatorDisabledColor() const +{ + return QColor::fromRgba(0xFFFDFDFD); +} + +QColor QQuickDefaultStyle::indicatorFrameColor() const +{ + return QColor::fromRgba(0xFF909090); +} + +QColor QQuickDefaultStyle::indicatorFramePressedColor() const +{ + return QColor::fromRgba(0xFF808080); +} + +QColor QQuickDefaultStyle::indicatorFrameDisabledColor() const +{ + return QColor::fromRgba(0xFFD6D6D6); +} + +QColor QQuickDefaultStyle::frameDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::frameLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarPressedColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::progressBarColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::pageIndicatorColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::separatorColor() const +{ + return QColor::fromRgba(0xFFCCCCCC); +} + +QColor QQuickDefaultStyle::disabledDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::disabledLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/default/qquickdefaultstyle_p.h b/src/imports/controls/default/qquickdefaultstyle_p.h new file mode 100644 index 00000000..fcd489a0 --- /dev/null +++ b/src/imports/controls/default/qquickdefaultstyle_p.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTSTYLE_P_H +#define QQUICKDEFAULTSTYLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qobject.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_NAMESPACE + +class QQuickDefaultStyle : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor backgroundColor READ backgroundColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayModalColor READ overlayModalColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayDimColor READ overlayDimColor CONSTANT FINAL) + Q_PROPERTY(QColor textColor READ textColor CONSTANT FINAL) + Q_PROPERTY(QColor textDarkColor READ textDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor textLightColor READ textLightColor CONSTANT FINAL) + Q_PROPERTY(QColor textLinkColor READ textLinkColor CONSTANT FINAL) + Q_PROPERTY(QColor textSelectionColor READ textSelectionColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledColor READ textDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledLightColor READ textDisabledLightColor CONSTANT FINAL) + Q_PROPERTY(QColor textPlaceholderColor READ textPlaceholderColor CONSTANT FINAL) + Q_PROPERTY(QColor focusColor READ focusColor CONSTANT FINAL) + Q_PROPERTY(QColor focusLightColor READ focusLightColor CONSTANT FINAL) + Q_PROPERTY(QColor focusPressedColor READ focusPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonColor READ buttonColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonPressedColor READ buttonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedColor READ buttonCheckedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedPressedColor READ buttonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedFocusColor READ buttonCheckedFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor toolButtonColor READ toolButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonColor READ tabButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonPressedColor READ tabButtonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonCheckedPressedColor READ tabButtonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateColor READ delegateColor CONSTANT FINAL) + Q_PROPERTY(QColor delegatePressedColor READ delegatePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateFocusColor READ delegateFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorPressedColor READ indicatorPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorDisabledColor READ indicatorDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameColor READ indicatorFrameColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFramePressedColor READ indicatorFramePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameDisabledColor READ indicatorFrameDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor frameDarkColor READ frameDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor frameLightColor READ frameLightColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarColor READ scrollBarColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor progressBarColor READ progressBarColor CONSTANT FINAL) + Q_PROPERTY(QColor pageIndicatorColor READ pageIndicatorColor CONSTANT FINAL) + Q_PROPERTY(QColor separatorColor READ separatorColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledDarkColor READ disabledDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledLightColor READ disabledLightColor CONSTANT FINAL) + +public: + explicit QQuickDefaultStyle(QObject *parent = nullptr); + + QColor backgroundColor() const; + QColor overlayModalColor() const; + QColor overlayDimColor() const; + QColor textColor() const; + QColor textDarkColor() const; + QColor textLightColor() const; + QColor textLinkColor() const; + QColor textSelectionColor() const; + QColor textDisabledColor() const; + QColor textDisabledLightColor() const; + QColor textPlaceholderColor() const; + QColor focusColor() const; + QColor focusLightColor() const; + QColor focusPressedColor() const; + QColor buttonColor() const; + QColor buttonPressedColor() const; + QColor buttonCheckedColor() const; + QColor buttonCheckedPressedColor() const; + QColor buttonCheckedFocusColor() const; + QColor toolButtonColor() const; + QColor tabButtonColor() const; + QColor tabButtonPressedColor() const; + QColor tabButtonCheckedPressedColor() const; + QColor delegateColor() const; + QColor delegatePressedColor() const; + QColor delegateFocusColor() const; + QColor indicatorPressedColor() const; + QColor indicatorDisabledColor() const; + QColor indicatorFrameColor() const; + QColor indicatorFramePressedColor() const; + QColor indicatorFrameDisabledColor() const; + QColor frameDarkColor() const; + QColor frameLightColor() const; + QColor scrollBarColor() const; + QColor scrollBarPressedColor() const; + QColor progressBarColor() const; + QColor pageIndicatorColor() const; + QColor separatorColor() const; + QColor disabledDarkColor() const; + QColor disabledLightColor() const; +}; + +QT_END_NAMESPACE + +#endif // QQUICKDEFAULTSTYLE_P_H diff --git a/src/imports/controls/default/qquickdefaulttheme.cpp b/src/imports/controls/default/qquickdefaulttheme.cpp new file mode 100644 index 00000000..26fb2a2f --- /dev/null +++ b/src/imports/controls/default/qquickdefaulttheme.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickdefaulttheme_p.h" + +#include <QtQuickTemplates2/private/qquicktheme_p.h> + +QT_BEGIN_NAMESPACE + +void QQuickDefaultTheme::initialize(QQuickTheme *theme) +{ + QPalette systemPalette; + + systemPalette.setColor(QPalette::Base, QColor::fromRgba(0xFFFFFFFF)); + systemPalette.setColor(QPalette::Disabled, QPalette::Base, QColor::fromRgba(0xFFD6D6D6)); + + systemPalette.setColor(QPalette::Button, QColor::fromRgba(0xFFE0E0E0)); + + systemPalette.setColor(QPalette::ButtonText, QColor::fromRgba(0xFF26282A)); + systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgba(0x4D26282A)); + + systemPalette.setColor(QPalette::BrightText, QColor::fromRgba(0xFFFFFFFF)); + systemPalette.setColor(QPalette::Disabled, QPalette::BrightText, QColor::fromRgba(0x4DFFFFFF)); + + systemPalette.setColor(QPalette::Dark, QColor::fromRgba(0xFF353637)); + + systemPalette.setColor(QPalette::Highlight, QColor::fromRgba(0xFF0066FF)); + systemPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor::fromRgba(0xFFF0F6FF)); + + systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(0xFF090909)); + + systemPalette.setColor(QPalette::Light, QColor::fromRgba(0xFFF6F6F6)); + + systemPalette.setColor(QPalette::Link, QColor::fromRgba(0xFF45A7D7)); + + systemPalette.setColor(QPalette::Mid, QColor::fromRgba(0xFFBDBDBD)); + + systemPalette.setColor(QPalette::Midlight, QColor::fromRgba(0xFFE4E4E4)); + + systemPalette.setColor(QPalette::Text, QColor::fromRgba(0xFF353637)); + systemPalette.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgba(0x7F353637)); + + systemPalette.setColor(QPalette::Shadow, QColor::fromRgba(0xFF28282A)); + + systemPalette.setColor(QPalette::ToolTipBase, QColor::fromRgba(0xFFFFFFFF)); + systemPalette.setColor(QPalette::ToolTipText, QColor::fromRgba(0xFF000000)); + + systemPalette.setColor(QPalette::Window, QColor::fromRgba(0xFFFFFFFF)); + + systemPalette.setColor(QPalette::WindowText, QColor::fromRgba(0xFF26282A)); + systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgba(0xFFBDBEBF)); + + theme->setPalette(QQuickTheme::System, systemPalette); +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/default/qquickdefaulttheme_p.h b/src/imports/controls/default/qquickdefaulttheme_p.h new file mode 100644 index 00000000..3a7311c7 --- /dev/null +++ b/src/imports/controls/default/qquickdefaulttheme_p.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTTHEME_P_H +#define QQUICKDEFAULTTHEME_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +class QQuickTheme; + +class QQuickDefaultTheme +{ +public: + static void initialize(QQuickTheme *theme); +}; + +QT_END_NAMESPACE + +#endif // QQUICKDEFAULTTHEME_P_H diff --git a/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.cpp b/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.cpp new file mode 100644 index 00000000..6e396dcf --- /dev/null +++ b/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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$ +** +****************************************************************************/ + +#include <QtQuickControls2/private/qquickstyleplugin_p.h> + +#include "qquickdefaultbusyindicator_p.h" +#include "qquickdefaultdial_p.h" +#include "qquickdefaultprogressbar_p.h" +#include "qquickdefaultstyle_p.h" +#include "qquickdefaulttheme_p.h" + +QT_BEGIN_NAMESPACE + +class QtQuickControls2DefaultStylePlugin: public QQuickStylePlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtQuickControls2DefaultStylePlugin(QObject *parent = nullptr); + + void registerTypes(const char *uri) override; + + QString name() const override; + void initializeTheme(QQuickTheme *theme) override; +}; + +QtQuickControls2DefaultStylePlugin::QtQuickControls2DefaultStylePlugin(QObject *parent) : QQuickStylePlugin(parent) +{ +} + +void QtQuickControls2DefaultStylePlugin::registerTypes(const char *uri) +{ + // The minor version used to be the current Qt 5 minor. For compatibility it is the last + // Qt 5 release. + qmlRegisterModule(uri, 2, 15); + + // The minor version used to be the current Qt 5 minor. For compatibility it is the last + // Qt 5 release. + const QByteArray import = QByteArray(uri) + ".impl"; + qmlRegisterModule(import, 2, 15); + + // QtQuick.Controls.impl 2.0 (Qt 5.7) + qmlRegisterType<QQuickDefaultBusyIndicator>(import, 2, 0, "BusyIndicatorImpl"); + qmlRegisterType<QQuickDefaultDial>(import, 2, 0, "DialImpl"); + qmlRegisterType<QQuickDefaultProgressBar>(import, 2, 0, "ProgressBarImpl"); + + // QtQuick.Controls.impl 2.1 (Qt 5.8) + qmlRegisterSingletonType<QQuickDefaultStyle>(import, 2, 1, "Default", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* { + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + return new QQuickDefaultStyle; + }); +} + +QString QtQuickControls2DefaultStylePlugin::name() const +{ + return QStringLiteral("Default"); +} + +void QtQuickControls2DefaultStylePlugin::initializeTheme(QQuickTheme *theme) +{ + QQuickDefaultTheme::initialize(theme); +} + +QT_END_NAMESPACE + +#include "qtquickcontrols2defaultstyleplugin.moc" diff --git a/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.qrc b/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.qrc new file mode 100644 index 00000000..eddadf2d --- /dev/null +++ b/src/imports/controls/default/qtquickcontrols2defaultstyleplugin.qrc @@ -0,0 +1,24 @@ +<RCC> + <qresource prefix="/qt-project.org/imports/QtQuick/Controls.2/Default"> + <file>images/arrow-indicator.png</file> + <file>images/arrow-indicator@2x.png</file> + <file>images/arrow-indicator@3x.png</file> + <file>images/arrow-indicator@4x.png</file> + <file>images/check.png</file> + <file>images/check@2x.png</file> + <file>images/check@3x.png</file> + <file>images/check@4x.png</file> + <file>images/dial-indicator.png</file> + <file>images/dial-indicator@2x.png</file> + <file>images/dial-indicator@3x.png</file> + <file>images/dial-indicator@4x.png</file> + <file>images/drop-indicator.png</file> + <file>images/drop-indicator@2x.png</file> + <file>images/drop-indicator@3x.png</file> + <file>images/drop-indicator@4x.png</file> + <file>images/double-arrow.png</file> + <file>images/double-arrow@2x.png</file> + <file>images/double-arrow@3x.png</file> + <file>images/double-arrow@4x.png</file> + </qresource> +</RCC> |