From e783bb87b83b0cb54cfa85ef305705512f61fbee Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 19 Nov 2020 12:48:57 +0100 Subject: Remove glow effects from automotive example For now there is no way to do this without writing them ourselves. Since the effect was fairly subtle, we simply live without it for now. Task-number: QTBUG-88202 Change-Id: Ic2556258461f657eddef3a597d928a7a0a7604c4 Reviewed-by: Laszlo Agocs --- .../imagine/automotive/CMakeLists.txt | 3 +- .../imagine/automotive/qml/CustomGlow.qml | 57 -------------- .../imagine/automotive/qml/GlowingLabel.qml | 90 ---------------------- .../imagine/automotive/qml/LargeLabel.qml | 84 ++++++++++++++++++++ .../imagine/automotive/qml/automotive.qml | 30 +++----- .../quickcontrols2/imagine/automotive/qml/qml.qrc | 3 +- 6 files changed, 97 insertions(+), 170 deletions(-) delete mode 100644 examples/quickcontrols2/imagine/automotive/qml/CustomGlow.qml delete mode 100644 examples/quickcontrols2/imagine/automotive/qml/GlowingLabel.qml create mode 100644 examples/quickcontrols2/imagine/automotive/qml/LargeLabel.qml (limited to 'examples') diff --git a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt index 690edaba..ad417e51 100644 --- a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt +++ b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt @@ -160,9 +160,8 @@ qt6_add_resources(automotive "imagine-assets" ${imagine-assets_resource_files} ) set(qml_resource_files - "CustomGlow.qml" "FeatureButton.qml" - "GlowingLabel.qml" + "LargeLabel.qml" "automotive.qml" ) diff --git a/examples/quickcontrols2/imagine/automotive/qml/CustomGlow.qml b/examples/quickcontrols2/imagine/automotive/qml/CustomGlow.qml deleted file mode 100644 index e8481930..00000000 --- a/examples/quickcontrols2/imagine/automotive/qml/CustomGlow.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtGraphicalEffects - -Glow { - color: glowColor - samples: 20 - spread: 0.3 -} diff --git a/examples/quickcontrols2/imagine/automotive/qml/GlowingLabel.qml b/examples/quickcontrols2/imagine/automotive/qml/GlowingLabel.qml deleted file mode 100644 index 39c5d6fe..00000000 --- a/examples/quickcontrols2/imagine/automotive/qml/GlowingLabel.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtQuick.Controls - -// This container and the transform on the Label are -// necessary to get precise bounding rect of the text for layouting reasons, -// since some of the labels' font sizes can get quite large. -Item { - id: root - implicitHeight: labelTextMetrics.tightBoundingRect.height - implicitWidth: label.implicitWidth - - property alias text: label.text - property alias font: label.font - property alias horizontalAlignment: label.horizontalAlignment - property alias verticalAlignment: label.verticalAlignment - property bool glowEnabled: true - property color glowColor: colorGlow - property color color: colorBright - - Label { - id: label - anchors.baseline: root.baseline - color: root.color - - layer.enabled: root.glowEnabled - layer.effect: CustomGlow { - color: glowColor - } - - TextMetrics { - id: labelTextMetrics - text: label.text - font: label.font - } - - transform: Translate { - y: -labelTextMetrics.tightBoundingRect.y - } - } -} diff --git a/examples/quickcontrols2/imagine/automotive/qml/LargeLabel.qml b/examples/quickcontrols2/imagine/automotive/qml/LargeLabel.qml new file mode 100644 index 00000000..186e2826 --- /dev/null +++ b/examples/quickcontrols2/imagine/automotive/qml/LargeLabel.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls + +// This container and the transform on the Label are +// necessary to get precise bounding rect of the text for layouting reasons, +// since some of the labels' font sizes can get quite large. +Item { + id: root + implicitHeight: labelTextMetrics.tightBoundingRect.height + implicitWidth: label.implicitWidth + + property alias text: label.text + property alias font: label.font + property alias horizontalAlignment: label.horizontalAlignment + property alias verticalAlignment: label.verticalAlignment + property bool glowEnabled: true + property color color: colorBright + + Label { + id: label + anchors.baseline: root.baseline + color: root.color + + TextMetrics { + id: labelTextMetrics + text: label.text + font: label.font + } + + transform: Translate { + y: -labelTextMetrics.tightBoundingRect.y + } + } +} diff --git a/examples/quickcontrols2/imagine/automotive/qml/automotive.qml b/examples/quickcontrols2/imagine/automotive/qml/automotive.qml index ebf1a445..47341758 100644 --- a/examples/quickcontrols2/imagine/automotive/qml/automotive.qml +++ b/examples/quickcontrols2/imagine/automotive/qml/automotive.qml @@ -189,7 +189,7 @@ ApplicationWindow { } } - GlowingLabel { + LargeLabel { text: qsTr("VOLUME") color: "white" font.pixelSize: fontSizeMedium @@ -226,7 +226,7 @@ ApplicationWindow { RowLayout { Layout.topMargin: 16 - GlowingLabel { + LargeLabel { id: radioOption text: qsTr("RADIO") color: "white" @@ -235,7 +235,7 @@ ApplicationWindow { Layout.fillWidth: true } - GlowingLabel { + LargeLabel { text: qsTr("AUX") color: colorLightGrey font.pixelSize: fontSizeMedium * 0.8 @@ -245,7 +245,7 @@ ApplicationWindow { Layout.alignment: Qt.AlignBottom Layout.fillWidth: true } - GlowingLabel { + LargeLabel { text: qsTr("MP3") color: colorDarkGrey font.pixelSize: fontSizeMedium * 0.6 @@ -366,14 +366,14 @@ ApplicationWindow { Layout.fillWidth: true Layout.fillHeight: true - GlowingLabel { + LargeLabel { id: timeLabel text: qsTr("11:02") font.pixelSize: fontSizeExtraLarge Layout.alignment: Qt.AlignHCenter - GlowingLabel { + LargeLabel { text: qsTr("AM") font.pixelSize: fontSizeLarge anchors.left: parent.right @@ -405,19 +405,11 @@ ApplicationWindow { Image { source: "qrc:/icons/warning.png" anchors.horizontalCenter: parent.horizontalCenter - - layer.enabled: true - layer.effect: CustomGlow { - spread: 0.2 - samples: 40 - color: colorWarning - } } - GlowingLabel { + LargeLabel { text: qsTr("Door open") color: colorWarning - glowColor: Qt.rgba(colorWarning.r, colorWarning.g, colorWarning.b, 0.4) } } } @@ -443,13 +435,13 @@ ApplicationWindow { Row { anchors.horizontalCenter: parent.horizontalCenter - GlowingLabel { + LargeLabel { id: outsideTempValueLabel text: qsTr("31") font.pixelSize: fontSizeExtraLarge } - GlowingLabel { + LargeLabel { text: qsTr("°C") font.pixelSize: Qt.application.font.pixelSize * 2.5 anchors.baseline: outsideTempValueLabel.baseline @@ -498,7 +490,7 @@ ApplicationWindow { anchors.left: parent.left } - GlowingLabel { + LargeLabel { id: temperatureValueLabel text: qsTr("24°C") font.pixelSize: fontSizeLarge @@ -523,7 +515,7 @@ ApplicationWindow { anchors.left: parent.left } - GlowingLabel { + LargeLabel { id: powerValueLabel text: qsTr("10%") font.pixelSize: fontSizeLarge diff --git a/examples/quickcontrols2/imagine/automotive/qml/qml.qrc b/examples/quickcontrols2/imagine/automotive/qml/qml.qrc index d193fd32..b0e4e558 100644 --- a/examples/quickcontrols2/imagine/automotive/qml/qml.qrc +++ b/examples/quickcontrols2/imagine/automotive/qml/qml.qrc @@ -1,8 +1,7 @@ FeatureButton.qml - GlowingLabel.qml - CustomGlow.qml automotive.qml + LargeLabel.qml -- cgit v1.2.3