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();
}
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With