×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    34

    How to show an app icon in a ListWidget

    Hi,

    I am trying to display the icon of an app that I got from the RApaLsSession. I get the full file name and store it in QString. The file name looks something like this: Z:\resources\apps\browserng_aif.mif

    Now when I try to set the icon on a QListWidgetItem I do not see the icon. Here is my code:
    Code:
    QListWidgetItem* item = new QListWidgetItem("Some Text");
    item->setIcon(QIcon("Z:\resources\apps\browserng_aif.mif"));
    ui.listWidget->addItem(item);
    Any help would be appreciated.

    Thanks

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to show an app icon in a ListWidget

    can you 1st try uploading the _aif.mif file to a widget .. if that is possible or not.

  3. #3
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to show an app icon in a ListWidget

    Use QFile to test whether the file is actually where you think it is.

  4. #4
    Nokia Developer Expert
    Join Date
    Feb 2008
    Posts
    183

    Re: How to show an app icon in a ListWidget

    I am fairly certain that Qt does not support mif-files as image sources.

    To work around this, use a native method to load up the mif icon to a CFBsBitmap and then convert that to QIcon/QImage/QPixmap with the Qt APIs.

  5. #5
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to show an app icon in a ListWidget

    Quote Originally Posted by Fuzzbender View Post
    I am fairly certain that Qt does not support mif-files as image sources.

    To work around this, use a native method to load up the mif icon to a CFBsBitmap and then convert that to QIcon/QImage/QPixmap with the Qt APIs.
    This article may help you regarding adding Icon : http://wiki.forum.nokia.com/index.ph...n_to_QComboBox

    Best regards,

  6. #6
    Registered User
    Join Date
    Dec 2010
    Posts
    62

    Re: How to show an app icon in a ListWidget

    Qt doesn't support MIF files, you need AknIconUtils first to read CFbsBitmap from .MIF, then use QPixmap::fromSymbianCFbsBitmap to convert to QPixmap.

    And the filename seems to be problem to. Qt uses unix style slashes "/" while Symbian uses Windows style "\". To use this filename, use QString::replace :

    QString fn("z:\resources\apps\images.mif");
    fn.replace("\","/");

    And you have working filename now.

  7. #7
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to show an app icon in a ListWidget

    No, still not working. QString fn("z:\\resources\\apps\\images.mif"); might work, though.

    (Generally, while "/" is preferred, Qt is "agnostic" with regard to "/" vs "\". But SQLite (and maybe some others) requires "\".)

Similar Threads

  1. How to show connection dialog without show View in GUI app (main app)
    By hariyanto_toto in forum Symbian User Interface
    Replies: 1
    Last Post: 2010-12-06, 06:58
  2. Replies: 2
    Last Post: 2010-01-22, 06:33
  3. [moved] Can't show App icon
    By vineet.jain in forum Symbian User Interface
    Replies: 6
    Last Post: 2009-02-27, 08:28
  4. Replies: 1
    Last Post: 2007-02-22, 13:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×