From 12b9f1df9f438f25947c96b99f7a11628b67a034 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 12 May 2023 19:43:24 -0400 Subject: [PATCH] components: Add TextDropShadow Introduce shadow component that uses MultiEffect from Qt 6.5 --- components/mobileshell/mobileshellplugin.cpp | 1 + .../mobileshell/qml/components/TextDropShadow.qml | 14 ++++++++++++++ components/mobileshell/resources.qrc | 1 + 3 files changed, 16 insertions(+) create mode 100644 components/mobileshell/qml/components/TextDropShadow.qml diff --git a/components/mobileshell/mobileshellplugin.cpp b/components/mobileshell/mobileshellplugin.cpp index 7bb7fc22..45fc9225 100644 --- a/components/mobileshell/mobileshellplugin.cpp +++ b/components/mobileshell/mobileshellplugin.cpp @@ -54,6 +54,7 @@ void MobileShellPlugin::registerTypes(const char *uri) qmlRegisterType(resolvePath("components/ListView.qml"), uri, 1, 0, "ListView"); qmlRegisterType(resolvePath("components/PopupMenu.qml"), uri, 1, 0, "PopupMenu"); qmlRegisterType(resolvePath("components/StartupFeedback.qml"), uri, 1, 0, "StartupFeedback"); + qmlRegisterType(resolvePath("components/TextDropShadow.qml"), uri, 1, 0, "TextDropShadow"); qmlRegisterType(resolvePath("components/VelocityCalculator.qml"), uri, 1, 0, "VelocityCalculator"); // /dataproviders diff --git a/components/mobileshell/qml/components/TextDropShadow.qml b/components/mobileshell/qml/components/TextDropShadow.qml new file mode 100644 index 00000000..698d16d2 --- /dev/null +++ b/components/mobileshell/qml/components/TextDropShadow.qml @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick.Effects + +// Standard drop shadow for text in the shell. +// Use a drop shadow when text needs to be contrasted over a background. + +MultiEffect { + shadowEnabled: true + shadowVerticalOffset: 1 + blurMax: 8 + shadowOpacity: 0.6 +} diff --git a/components/mobileshell/resources.qrc b/components/mobileshell/resources.qrc index 73eccb66..369a58a2 100644 --- a/components/mobileshell/resources.qrc +++ b/components/mobileshell/resources.qrc @@ -32,6 +32,7 @@ qml/components/MarqueeLabel.qml qml/components/PopupMenu.qml qml/components/StartupFeedback.qml + qml/components/TextDropShadow.qml qml/components/util.js qml/components/VelocityCalculator.qml