2

In QML for Qt5 I could use ColorOverlay to apply a color to an image.

But in Qt6, it no longer exists.

What is the best way to color an image in QML for Qt6?

Aaron
  • 759
  • 1
  • 7
  • 15
  • Does this answer your question? [QML QtGraphicalEffects is not Installed](https://stackoverflow.com/questions/68292911/qml-qtgraphicaleffects-is-not-installed) – musicamante Jan 22 '22 at 01:15
  • Qt6 still provides support for Graphics Effects, through the [`Qt5Compat.GraphicalEffects`](https://doc.qt.io/qt-6/qtgraphicaleffects5-index.html) module. Alternatively, look into [shader effects](https://doc.qt.io/qt-6/qml-qtquick-shadereffect.html). – musicamante Jan 22 '22 at 01:15
  • Thanks, unfortunately I don't know how to install the qt5 compat module. I'm using Ubuntu Linux and I've only heard of a package on ArchLinux. – Aaron Jan 22 '22 at 05:07
  • 1
    I've just noticed that you've already asked about that. I'd suggest you to look into shader effects, but in any case there is a package in experimental debian repos: https://packages.debian.org/experimental/qml6-module-qt5compat-graphicaleffects so you could *try* to install it (at your own risk). I'd also find means to submit a request to the Ubuntu repository mantainers (maybe through their irc channel or mailing list) and ask about its insertion or any suggestion. – musicamante Jan 22 '22 at 13:52
  • thanks i just ended up editing the svg files directly until the feature is supported – Aaron Jan 22 '22 at 20:36
  • 1
    I'm afraid you've not understood the problem: the GraphicalEffects module of Qt5Compat is not temporarily there waiting for support, it's only provided to facilitate porting for *backward* compatibility with Qt5 (hence the name), and it doesn't even include all effects. Graphical Effects will *not* be supported otherwise, they are already considered partially obsolete (due to the shader/particle system), and it's also possible that in the years to come it will be actually declared as deprecated, meaning that the module will not be updated nor made available anymore for future releases of Qt6. – musicamante Jan 23 '22 at 03:34
  • Yes I understood thanks – Aaron Jan 27 '22 at 01:18
  • There are ways to color an image without the need of QtGraphicalEffects. Can you tell us more about your requirements and perhaps we can provide a more concrete solution? Meanwhile, see my answer here https://stackoverflow.com/a/72947097/881441 – Stephen Quan Jul 12 '22 at 04:51
  • Warning, I found that combining Qt5Compat.GraphicalEffects and Qt6 on TI AM335x ARM boards causing the QSGRenderThread to crash. So maybe better just find some Qt6-based solutions. – Ted Feng Nov 16 '22 at 05:35

0 Answers0