Hurzelchen
Hurzelchen

Reputation: 576

QSystemTrayIcon not showing in notification area on Ubuntu 14.04

I'm writing an application that uses an QSystemTrayIcon. Everything works as expected, but the icon does not show up in the Unity notification area on the top right but just in the upper left corner.

The current build environment is clang 3.4, QT 5.3 on Ubuntu 14.04. When cross-compiling with MinGW and running the app in wine, the icon shows up correctly.

Is this maybe a missing setting in Ubuntu?

Here's a simple snippet that produces the same behavior:

#include <QSystemTrayIcon>
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPixmap pixmap(32, 32);
    pixmap.fill(Qt::red);

    QIcon icon(pixmap);

    QSystemTrayIcon trayIcon(icon);

    QObject::connect(&trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), &app, SLOT(quit()));

    trayIcon.show();

    return app.exec();
}

Upvotes: 6

Views: 1630

Answers (1)

jans
jans

Reputation: 1798

The issue you describe is a known and currently unfixed bug. See https://bugreports.qt.io/browse/QTBUG-31762

Workaround:

sudo apt-add-repository ppa:gurqn/systray-trusty
sudo apt-get update
sudo apt-get upgrade

Upvotes: 3

Related Questions