diff options
| author | Erik Prabowo Kamal <erik@darapsa.org> | 2025-12-12 18:27:50 +0800 |
|---|---|---|
| committer | Erik Prabowo Kamal <erik@darapsa.org> | 2025-12-12 18:27:50 +0800 |
| commit | e8f2d82e994973a274ec3a72cbb568baffb91ffc (patch) | |
| tree | d38d8cfdb29f4081b7e96bd12a1c939895f0a88d /Course/Grid | |
| parent | 93b25dfa97494184493e02b75766e57bc6fe79bb (diff) | |
Reimplement Qt5 ColorOverlay using Qt6 MultiEffect
https://stackoverflow.com/questions/70809206/color-overlay-an-image-in-qml-qt6#77060406
Even though the answer is not checked, but the Qt6.8 works, and after
following the suggestion in its comment about brightness.
The MultiEffect needs to be put outside of the Image when they're on a
Button. Having MultiEffect as the Image layer's effect only works when
it's not on a Button.
Diffstat (limited to 'Course/Grid')
| -rw-r--r-- | Course/Grid/Card.ui.qml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Course/Grid/Card.ui.qml b/Course/Grid/Card.ui.qml index 194f42b..36893c2 100644 --- a/Course/Grid/Card.ui.qml +++ b/Course/Grid/Card.ui.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts +import QtQuick.Effects import Qt5Compat.GraphicalEffects Item { @@ -200,10 +201,13 @@ Item { source: "Material/svg/outlined/schedule.svg" sourceSize.height: 16 sourceSize.width: 16 - ColorOverlay { - anchors.fill: timerIcon - source: timerIcon - color: "#d6293e" + layer { + enabled: true + effect: MultiEffect { + brightness: 1.0 + colorization: 1.0 + colorizationColor: "#d6293e" + } } } @@ -225,10 +229,13 @@ Item { source: "Material/svg/outlined/table.svg" sourceSize.height: 16 sourceSize.width: 16 - ColorOverlay { - anchors.fill: lecturersIcon - source: lecturersIcon - color: "#fd7e14" + layer { + enabled: true + effect: MultiEffect { + brightness: 1.0 + colorization: 1.0 + colorizationColor: "#fd7e14" + } } } |