ManuelSchneid3r
ManuelSchneid3r

Reputation: 16091

Display decoration in ListView delegate

I have a C++ model that is used in QML. It's working fine, but I have problems showing decoration. How can I display icons in QML? I have searched the documentation and the web, no success. Image doesn't work either.

Upvotes: 0

Views: 349

Answers (1)

dtech
dtech

Reputation: 49289

You have two options:

  • provide the icon as a string with a path to the icon file and use an Image element in QML to load the icon from the path string.

  • provide the icon as a QImage and use a custom image provider to use the QImage as a source for a QML Image.

The second approach is overkill in your case, but still, image interop between C++ and QML is possible if you need it in future.

Upvotes: 1

Related Questions