Important: Please read the Qt Code of Conduct -

QSystemTrayIcon issue on Ubuntu 16.04

  • I'm using Qt 5.7.1 on Ubuntu 16.04. Basically I have an app which opens a widget when a click on tray icon is performed.
    However when I click on the tray an ugly empty menu is displayed and the signal is not emitted at all.

    This works on OSX 10.12.2, Windows 10 and Fedora 21, Gnome 3.14

    Can someone help me suggesting a workaround? It seems a Qt bug...

    The code is the following:


    #include <QApplication>
    #include "mytray.h"
    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        myTray w;
        return a.exec();


    #pragma once
    #include <QSystemTrayIcon>
    class myTray : public QSystemTrayIcon
        explicit myTray(QObject *parent=0);
    private slots:
        void showPopup(QSystemTrayIcon::ActivationReason);


    #include "mytray.h"
    #include <QMessageBox>
    myTray::myTray(QObject *parent)
        connect(this ,&QSystemTrayIcon::activated,
                this, &myTray::showPopup);
        //TODO: use an available icon
    void myTray::showPopup(QSystemTrayIcon::ActivationReason)
            QMessageBox::information(nullptr, "Hello", "Hello");

  • Lifetime Qt Champion


    Before calling it a Qt bug, you should test your application by building it with Ubuntu's provided Qt. They might have done customisation for their window manager.

  • Lifetime Qt Champion

    Just out of curiosity, is this on unity desktop ?

  • @mrjj
    Yes it is a unity desktop

  • Lifetime Qt Champion

    Ok, they often have to add stuff to Qt to make it work in unity due to its
    special nature.
    So only way forward is to check as
    @SGaist suggest with the Qt included in the distro.

Log in to reply