diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/CheckBox.qml | 29 | ||||
-rw-r--r-- | src/imports/controls/CheckDelegate.qml | 30 | ||||
-rw-r--r-- | src/imports/controls/CheckIndicator.qml | 70 | ||||
-rw-r--r-- | src/imports/controls/controls.pri | 1 | ||||
-rw-r--r-- | src/imports/controls/plugins.qmltypes | 9 | ||||
-rw-r--r-- | src/imports/controls/qtquickcontrols2plugin.cpp | 1 |
6 files changed, 54 insertions, 86 deletions
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml index 4348781d..ec539b19 100644 --- a/src/imports/controls/CheckBox.qml +++ b/src/imports/controls/CheckBox.qml @@ -52,10 +52,35 @@ T.CheckBox { padding: 6 spacing: 6 - indicator: CheckIndicator { + // keep in sync with CheckDelegate.qml (shared CheckIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 - control: control + + 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/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 { diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index 55dd05eb..36b9f2ba 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -71,11 +71,35 @@ T.CheckDelegate { color: control.palette.text } - indicator: CheckIndicator { - x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding + // keep in sync with CheckBox.qml (shared CheckIndicator.qml was removed for performance reasons) + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + + x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 - control: control + 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/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 { diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml deleted file mode 100644 index 730878be..00000000 --- a/src/imports/controls/CheckIndicator.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** 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.10 -import QtQuick.Controls 2.3 -import QtQuick.Controls.impl 2.3 - -Rectangle { - id: indicator - - property Item control - - implicitWidth: 28 - implicitHeight: 28 - - 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/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 - } -} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index 56c7a8ee..0bdf0e52 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -22,7 +22,6 @@ QML_CONTROLS = \ $$PWD/ButtonGroup.qml \ $$PWD/CheckBox.qml \ $$PWD/CheckDelegate.qml \ - $$PWD/CheckIndicator.qml \ $$PWD/ComboBox.qml \ $$PWD/Container.qml \ $$PWD/Control.qml \ diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index a4f59481..ff096286 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -255,15 +255,6 @@ Module { defaultProperty: "data" } Component { - prototype: "QQuickRectangle" - name: "QtQuick.Controls.impl/CheckIndicator 2.0" - exports: ["QtQuick.Controls.impl/CheckIndicator 2.0"] - exportMetaObjectRevisions: [0] - isComposite: true - defaultProperty: "data" - Property { name: "control"; type: "QQuickItem"; isPointer: true } - } - Component { prototype: "QQuickComboBox" name: "QtQuick.Controls/ComboBox 2.0" exports: ["QtQuick.Controls/ComboBox 2.0"] diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 768f4ab8..29121a74 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -194,7 +194,6 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur qmlRegisterType<QQuickTumblerView>(import, 2, 1, "TumblerView"); #endif qmlRegisterSingletonType<QQuickDefaultStyle>(import, 2, 1, "Default", styleSingleton); - qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator"); |