Results 1 to 3 of 3

Thread: possible to convert string/numbers to tray icon?

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default possible to convert string/numbers to tray icon?

    i have tried the trolltech example that creates system tray but i havent been able to find a way to convert string or value to icon so i could create weather application that shows temperature in system tray. is this possible in qt or do i have to create own icon for each number?

    this was possible at least in c#
    http://blogs.msdn.com/abhinaba/archi...y-using-c.aspx

    thanks.

  2. #2
    Join Date
    Apr 2007
    Location
    Czech republic
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: possible to convert string/numbers to tray icon?

    Qt Code:
    1. TrayIco::TrayIco( QWidget * parent, Qt::WFlags f)
    2. : QMainWindow(parent, f)
    3. {
    4. setupUi(this);
    5.  
    6. QPixmap pixmap(16,16);
    7. pixmap.fill(Qt::transparent);
    8. QPainter painter(&pixmap);
    9. QString string;
    10. string = "48";
    11. painter.drawText(0,0,16,16,Qt::AlignHCenter | Qt::AlignVCenter, string);
    12.  
    13. ico = new QSystemTrayIcon(this);
    14.  
    15. ico->setIcon(QIcon(pixmap));
    16.  
    17. ico->show();
    18. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  3. #3
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: possible to convert string/numbers to tray icon?

    cool it worked.thanks

Similar Threads

  1. Replies: 4
    Last Post: 30th June 2008, 06:25
  2. Tray Icon
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 12th July 2007, 19:10
  3. QT4/QP Tray Icon
    By incapacitant in forum Newbie
    Replies: 12
    Last Post: 7th June 2006, 18:47

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.