diff options
| author | Erik Prabowo Kamal <erik@darapsa.org> | 2025-12-12 18:40:48 +0800 |
|---|---|---|
| committer | Erik Prabowo Kamal <erik@darapsa.org> | 2025-12-12 18:40:48 +0800 |
| commit | 70eefa50f9a70554d9db7004e48555858dfc008c (patch) | |
| tree | 4989a20b6676ab297bd5cffa75a1fdee33e53be2 /DropShadow | |
| parent | e8f2d82e994973a274ec3a72cbb568baffb91ffc (diff) | |
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.
Diffstat (limited to 'DropShadow')
| -rw-r--r-- | DropShadow/Box.ui.qml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/DropShadow/Box.ui.qml b/DropShadow/Box.ui.qml index b14aaa2..1fe1265 100644 --- a/DropShadow/Box.ui.qml +++ b/DropShadow/Box.ui.qml @@ -1,11 +1,11 @@ import QtQuick -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Eduport -DropShadow { - horizontalOffset: Eduport.bsBoxShadowOffsetX - verticalOffset: Eduport.bsBoxShadowOffsetY - radius: Eduport.bsBoxShadowBlurRadius / 5 - samples: radius * 2 + 1 - color: Eduport.bsBoxShadowColor +MultiEffect { + shadowEnabled: true + shadowHorizontalOffset: Eduport.bsBoxShadowOffsetX + shadowVerticalOffset: Eduport.bsBoxShadowOffsetY + shadowColor: Eduport.bsBoxShadowColor + shadowOpacity: Eduport.bsBoxShadowOpacity } |