Results 1 to 8 of 8

Thread: QSystemTrayIcon to handle both double left click and single left click!

  1. #1
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QSystemTrayIcon to handle both double left click and single left click!

    I am trying to achieve two different things when the user left single click and left double click on my tray icon. Left single click will only display the context menu and left double click will start the application. But unfortunately it is not working, because my slot for activated signal only handles trigger when the user double click my tray icon. Any thought will be very helpful. Thanks.

  2. #2
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    How you handle QSystemTrayIcon::ActivationReason? If i'm not mistaken, when user double-clicked the tray icon, QSystemTrayIcon::activated signal emitted twice, first it send QSystemTrayIcon::Trigger, after that it send QSystemTrayIcon::DoubleClick.
    ~ We are nothing in this universe ~

  3. #3
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    You are absolutely right. My code is handling trigger signal but ignoring the DoubleClicked signal. I don't know why, any idea?

  4. #4
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    Can you post the source code for handling activate signal?
    ~ We are nothing in this universe ~

  5. #5
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    Here is my code.
    Qt Code:
    1. void SystemTray::onSystemTrayLeftClicked( QSystemTrayIcon::ActivationReason Reason )
    2. {
    3. updateTrayStates( ) ;
    4.  
    5. if ( Reason == QSystemTrayIcon::DoubleClick )
    6. {
    7.  
    8. m_pActionTrayLogin->trigger() ; //
    9. } else if ( Reason == QSystemTrayIcon::Trigger ) {
    10.  
    11. this->contextMenu()->popup(QCursor::pos());
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    Please use [code] tag to format code.
    ~ We are nothing in this universe ~

  7. #7
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    Thanks for reminding me. But that was a type-o.
    Last edited by chandan; 26th April 2012 at 13:15.

  8. #8
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QSystemTrayIcon to handle both double left click and single left click!

    My code is handling trigger signal but ignoring the DoubleClicked signal
    Have you debug? Are you sure the slot doesn't called when the tray icon double-clicked?
    ~ We are nothing in this universe ~

Similar Threads

  1. Mouse Right or Left click ???
    By anjanu in forum Qt Programming
    Replies: 9
    Last Post: 27th August 2011, 19:41
  2. Qtablewidget left mouse click event in python
    By gerocampo in forum Newbie
    Replies: 0
    Last Post: 23rd July 2010, 18:05
  3. Replies: 4
    Last Post: 30th May 2010, 13:55
  4. Emulating Enter key with left mouse click
    By wconstan in forum Newbie
    Replies: 6
    Last Post: 30th December 2009, 17:16
  5. Replies: 6
    Last Post: 5th June 2009, 10:38

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.