August 8, 2011

kkrzewniak kkrzewniak
Lab Rat
218 posts

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?

 Signature 

Me, Grimlock, not “nice dino”. ME BASH BRAINS!

3 replies

August 8, 2011

ucomesdag ucomesdag
Lab Rat
243 posts

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

 Signature 

Write “Qt”, not “QT” (QuickTime).

August 8, 2011

kkrzewniak kkrzewniak
Lab Rat
218 posts

Thanks I knew this actually but was wondering if there was nicer way of doing that than:

  1. class PlatformIconProvider : public QDeclarativeImageProvider
  2. {
  3. ...
  4. };
  5.  
  6. QImage PlatformIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
  7. {
  8.     QImage result;
  9.     if(result.load(QLatin1String("/usr/share/themes/blanco/meegotouch/icons/") + id + QLatin1String(".png"))) {
  10.         qDebug() << "Loaded: " << id;
  11.     }
  12.     return result;
  13. }

 Signature 

Me, Grimlock, not “nice dino”. ME BASH BRAINS!

August 8, 2011

ucomesdag ucomesdag
Lab Rat
243 posts

See the example gallery [qt.gitorious.org] they use

  1. background: "image://theme/meegotouch-wallpaper-portrait";

for /usr/share/themes/blanco/meegotouch/images/backgrounds/meegotouch-wallpaper-portrait.jpg

So for example

  1. 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.

 Signature 

Write “Qt”, not “QT” (QuickTime).

 
  ‹‹ [Solved] Error with layouts      [Solved] Sliding Bar Graph ››

You must log in to post a reply. Not a member yet? Register here!