Qt6 topics merged with General

Native icons in QML on MeeGo Harmattan

  • Hi does anyone know if it's possible to access the icons for the current theme and use them in QML?

  • Yes, it's possible most icons are living in /usr/share/theme/blanco/meegotouch/icons ;-)

  • Thanks I knew this actually but was wondering if there was nicer way of doing that than:
    class PlatformIconProvider : public QDeclarativeImageProvider

    QImage PlatformIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
    QImage result;
    if(result.load(QLatin1String("/usr/share/themes/blanco/meegotouch/icons/") + id + QLatin1String(".png"))) {
    qDebug() << "Loaded: " << id;
    return result;

  • See the example "gallery":https://qt.gitorious.org/qt-components/qt-components/blobs/master/examples/meego/QmlComponentGallery/qml/main.qml they use @background: "image://theme/meegotouch-wallpaper-portrait";@
    for /usr/share/themes/blanco/meegotouch/images/backgrounds/meegotouch-wallpaper-portrait.jpg

    So for example @image://theme/icon-m-common-search@ for /usr/share/themes/blanco/meegotouch/icons/icon-m-common-search.png.

    I confirm that this works for me.

  • Is that something that's only built into meego, or would something like this work on a Linux desktop (and other OSes)?

  • Well it looks like I answered my own question, -when you use "image://theme/my_image" on desktop linux (I'm on Ubuntu), it searches in "current_theme/qmltheme/my_image", so you can't expect to be using your GTK or KDE icons like that, only whatever icons are in the qmltheme folder.-

    Never mind, I was mistaken, doesn't work at all on Linux, if someone knows of something similar that will, please do tell. Using image://theme/my_image actually just throws the error "invalid image provider"

Log in to reply