qtqmlshadowqt6

How to create DropShadow effect in QML with Qt6?


In Qt5 this was easy with using DropShadow.
But in Qt6 the module QtGraphicalEffects is removed.

Is there any trick, workaround or maybe new way in Qt6 to create drop shadow around some component?


Solution

  • As you noticed yourself, Qt Graphical Effects is removed (definitely):

    The following modules are removed and not planned to be developed further.

    • Qt Graphical Effects
    • [...]

    However, the Qt Graphical Effects is made compatible with the new QRhi (Qt Rendering Hardware Interface) used by Qt6. [1]

    Note that this doesn't mean it will be included in Qt 6 at a later stage. [2]

    Nevertheless, I expect it would be relatively easy to use DropShadow from the dev or Qt 5.15 branch of git.

    Note that it is included as a Qt5 Compatibility API in Qt6.1: DropShadow.