Results 1 to 5 of 5

Thread: Problem with application icon

  1. #1
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Problem with application icon

    Hi

    I am getting strange problem with application icon. I have created sample application and trying to set the application icon using the setWIndowIcon().
    I have created .rc file and added it to the .pro file.
    When i run the application from visual studio, it shows the icon on top left of the main window.
    But if i run the appliaction through explorer by doule clicking the .exe, it shows default icon.

    .exe created did show the application icon. Bu the application is showing deafult icon.

    If i put the icon file near b y .exe, then it correctly shows the icon on the top left corner.

    It seems that there is problem with path of the icon file. But i believe that resources should get bundled with the .exe.

    Can any one tell me whats going wrong.


    Thanks in advance.


    Regards,
    ~Sanjay

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with application icon

    Application icon and window icon are two different things, so decide which one you want.

    You are probably using a relative path to your icon and when the application is started from a different directory than you expect (as it takes place when double-clicking the icon in the desktop), the icon can't be located. Either use an absolute path or embed the icon into your application binary using Qt's resource system.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with application icon

    Quote Originally Posted by sanjayshelke View Post
    But i believe that resources should get bundled with the .exe.
    they will get, when you supply em properly. See qt docs for it.
    The Qt Resource System.
    Last edited by yogeshgokul; 8th September 2009 at 09:41.

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with application icon

    qt resource system (qrc files) do embed the files(pics or anything) directly into the exe..
    also the default resource files which you embed by visual studio are also inside the exe..
    so in both cases there should be no need to supplying them with the files..

    it seems your are setting the icon by its path, not the ":image/..." of qrc.. check it again.. or better provide a minimal compilable example.

  5. #5
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with application icon

    Thanks.
    We can embed the window icon into our application binary.
    its working.

    thanks a lot.

Similar Threads

  1. Application icon - Qt S60
    By ppaluch in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 23rd November 2010, 11:17
  2. How to set the application icon in Linux?
    By live_07 in forum Newbie
    Replies: 11
    Last Post: 24th September 2010, 09:39
  3. Replies: 0
    Last Post: 2nd September 2008, 04:29
  4. getting problem in running qtopia home screen application
    By afgan_rajesh in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 31st January 2008, 07:01
  5. Replies: 7
    Last Post: 28th June 2007, 17:18

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.