From 70eefa50f9a70554d9db7004e48555858dfc008c Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 12 Dec 2025 18:40:48 +0800 Subject: Reimplement Qt5 DropShadow using Qt6 MultiEffect https://stackoverflow.com/questions/66145143/how-to-create-dropshadow-effect-in-qml-with-qt6#66162760 Didn't follow the checked answer cause it's still using Qt5Compat. Follow the 1st answer instead. Don't know how to reimplement DropShadow's samples & radius yet. Opacity needs to be separated, don't set it on Qt.rgba, otherwise the resulting colour would be too soft/light/invisible. --- Course/Grid/Card.ui.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Course') diff --git a/Course/Grid/Card.ui.qml b/Course/Grid/Card.ui.qml index 36893c2..dbc32ad 100644 --- a/Course/Grid/Card.ui.qml +++ b/Course/Grid/Card.ui.qml @@ -6,13 +6,13 @@ import Qt5Compat.GraphicalEffects Item { id: item1 - DropShadow { - color: "#4d000000" + MultiEffect { source: cardItem - verticalOffset: 4 - radius: 40 - samples: 81 anchors.fill: cardItem + shadowEnabled: true + shadowColor: "#4d0000" + shadowOpacity: .0 + shadowVerticalOffset: 4 } Rectangle { id: cardItem -- cgit v1.2.3