QSystemTrayIcon don`t emit signal "activated" when the icon clicked. I read that in the previous version it was a bug, but it should have been corrected.

I have Qt 5.5.0 + Ubuntu 14.04 (Gnome).

tray.h

Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. explicit MainWindow(QWidget *parent = 0);
  7. ~MainWindow();
  8.  
  9. private slots:
  10. void showMsg(QSystemTrayIcon::ActivationReason reason);
  11.  
  12. private:
  13. QSystemTrayIcon *trIcon;
  14. QAction *actClose;
  15. QMenu *menu;
  16.  
  17. };
To copy to clipboard, switch view to plain text mode 

tray.cpp

Qt Code:
  1. ...
  2. MainWindow::MainWindow(QWidget *parent) :
  3. QMainWindow(parent)
  4. {
  5.  
  6. actClose = new QAction("Close", this);
  7. ...
  8.  
  9. this->menuBar()->setNativeMenuBar(false);
  10. menu = menuBar()->addMenu(tr("&File"));
  11. menu->addAction(actClose);
  12.  
  13. trIcon = new QSystemTrayIcon(this);
  14. trIcon->setIcon(QIcon(":/main_icon.png"));
  15. trIcon->setContextMenu(menu);
  16.  
  17.  
  18. connect(trIcon, &QSystemTrayIcon::activated, this, &MainWindow::showMsg);
  19.  
  20. trIcon->show();
  21.  
  22.  
  23. }
  24.  
  25. MainWindow::~MainWindow()
  26. {
  27. }
  28.  
  29. void MainWindow::showMsg(QSystemTrayIcon::ActivationReason reason)
  30. {
  31. qDebug() << "show message";
  32.  
  33. }
To copy to clipboard, switch view to plain text mode 

Anybody have any idea? Thank)