Results 1 to 4 of 4

Thread: How to display Systemtray message ?

  1. #1
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default How to display Systemtray message ?

    Hi All,
    I'm creating a system tray and attaching an Bubble message to this, If the system is trying to connect to Server it should display that message. But the message is displaying on top. But i need to disaply it near the tray icon. herewith i ve attached the code please tell me how to solve this.

    Thank you all.
    Attached Files Attached Files

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

    Default Re: How to display Systemtray message ?

    Have look at Qt Demos there is a system tray example.

  3. #3
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display Systemtray message ?

    Quote Originally Posted by toutarrive View Post
    Have look at Qt Demos there is a system tray example.
    Ya , i went thru it. From there only i "ve my systemrayicon. I need to add the bubblemessage to added to this systemtrayicon. so that according to different slot i can display different messages .

  4. #4
    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: How to display Systemtray message ?

    Following is the updated code. Its working fine now.

    Qt Code:
    1. #include "dialog.h"
    2. #include "ui_dialog.h"
    3.  
    4. Dialog::Dialog(QWidget *parent)
    5. : QDialog(parent), ui(new Ui::Dialog)
    6. {
    7. ui->setupUi(this);
    8.  
    9. QIcon icon(":/resource/Test.jpg");
    10. m_ptrTrayIcon = new QSystemTrayIcon(this);
    11. m_ptrTrayIcon->setToolTip( tr( "Bubble Message" ) );
    12. m_ptrTrayIcon->show();
    13. m_ptrTrayIcon->setIcon(icon);
    14. // m_ptrTrayIcon->setContextMenu(m_trayIconMenu);
    15. }
    16.  
    17. Dialog::~Dialog()
    18. {
    19. delete ui;
    20. }
    21.  
    22. void Dialog::on_pushButton_clicked()
    23. {
    24. ShowMessage();
    25. //m_ptrTrayIcon->show();
    26. QDialog::accept();
    27. }
    28. void Dialog::ShowMessage()
    29. {
    30. m_ptrTrayIcon->showMessage("Hello", "World", QSystemTrayIcon::Critical, 151000);
    31. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. how to display dialog message
    By Petr_Kropotkin in forum Newbie
    Replies: 1
    Last Post: 12th January 2010, 14:16
  2. StatusBar Message
    By chethana in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2009, 15:44
  3. SOAP message
    By rohan_m_e in forum Qt Programming
    Replies: 2
    Last Post: 3rd December 2008, 09:01
  4. Replies: 4
    Last Post: 12th October 2008, 13:47
  5. Animated icon on SystemTray
    By arbi in forum Qt Programming
    Replies: 2
    Last Post: 11th September 2008, 14:35

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.