Results 1 to 3 of 3

Thread: Adding Icons

  1. #1
    Join Date
    Feb 2010
    Posts
    42
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Adding Icons

    I have tried doing
    Qt Code:
    1. MY_ICON ICON "C:\users\bijan\pictures\program icons\icon.ico"
    To copy to clipboard, switch view to plain text mode 
    but the icon only shows up in the desktop but it doesn't show up in the actual program (you can see what I mean in the attachments).
    I have also tried
    Qt Code:
    1. QApplication::setWindowIcon(QIcon(" C:\users\bijan\pictures\program icons\icon.ico"));
    To copy to clipboard, switch view to plain text mode 
    but that distorts the picture.

    Thank you in advance
    Attached Images Attached Images

  2. #2
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding Icons

    Did you add the icon file to your application.qrc in Creator?

  3. #3
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding Icons

    To set the application icon have look at : http://qt.nokia.com/doc/4.6/appicon.html

    The icon of the executable file is the one used by a shortcut or by windows explorer.
    Create a file called appIcon.rc with the following:
    Qt Code:
    1. IDI_ICON1 ICON DISCARDABLE "appIcon.ico"
    To copy to clipboard, switch view to plain text mode 
    And then add this line to your *.pro file:
    Qt Code:
    1. RC_FILE = appIcon.rc
    To copy to clipboard, switch view to plain text mode 

    To set the window icon (the one visible at the top left corner of your main window), use
    QApplication::setWindowIcon (const QIcon& icon) or QWidget::setWindowIcon(const QIcon& icon).
    Last edited by toutarrive; 27th March 2010 at 22:51.

  4. The following user says thank you to toutarrive for this useful post:

    bijan311 (27th March 2010)

Similar Threads

  1. Replies: 1
    Last Post: 22nd February 2010, 10:53
  2. Trolltech example - getting rid of icons?
    By teele in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2009, 18:59
  3. Where to get Icons from
    By pospiech in forum General Discussion
    Replies: 4
    Last Post: 19th December 2008, 21:14
  4. Replies: 9
    Last Post: 11th January 2007, 15:34
  5. (Qt 4) QTreeview and Icons?
    By pinktroll in forum Qt Programming
    Replies: 4
    Last Post: 17th August 2006, 16:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.