Results 1 to 5 of 5

Thread: QSystemTrayIcon - how to make one?

  1. #1
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question QSystemTrayIcon - how to make one?

    I did an application with a system tray icon and that works fine. However instead of the tray icon itself it is just an empy space in the systray.
    I have tryied:

    Qt Code:
    1. QIcon icon ("Envelop.ico");
    2. trayIcon->setIcon(icon);
    To copy to clipboard, switch view to plain text mode 

    but that do nothing. The manual uses an example with some icons in *.svg format but I have only .jpg or .ico. Can I use those and if yes, how? Please help.
    Last edited by jpn; 9th March 2008 at 10:37. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSystemTrayIcon - how to make one?

    ICO is not a supported image format (there's a commercial solution: ICO Image Format). For JPEG you must ensure that the JPEG image format plugin has been built. The safest and easiest way is to use PNG.
    J-P Nurmi

  3. #3
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Default Re: QSystemTrayIcon - how to make one?

    Thank you. I have converted my .ico file to .png
    and did:
    Qt Code:
    1. QIcon icon ("Envelop.png");
    2. trayIcon->setIcon(icon);
    To copy to clipboard, switch view to plain text mode 
    the Envelop.png is in the same directory as my program but that didn't work, the system tray still shows empty icon
    Last edited by jpn; 9th March 2008 at 11:10. Reason: missing [code] tags

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSystemTrayIcon - how to make one?

    Use QCoreApplication::applicationDirPath() or embed it as resource. You know, the current working directory depends on how the application is launched.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    slava (9th March 2008)

  6. #5
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Default Re: QSystemTrayIcon - how to make one?

    Thank you very much. I did it!

Similar Threads

  1. Replies: 1
    Last Post: 4th February 2008, 12:12
  2. QT4 for kde 4 beta 2 configure problem: make not found
    By marcomangiante in forum Installation and Deployment
    Replies: 1
    Last Post: 5th September 2007, 21:35
  3. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 11:43
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57
  5. Qt4.1.4 make errors.
    By impeteperry in forum Installation and Deployment
    Replies: 11
    Last Post: 1st July 2006, 18:27

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.