isSystemTrayAvailable() always crashes (Segfault) on Ubuntu 10.10 Desktop
-
You must construct a QApplication object first:
The following snippet works, if you leave out the QApplication it crashes:
@
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
bool ok = QSystemTrayIcon::isSystemTrayAvailable();
qDebug() << ok;return 0;
}
@ -
The sys tray is always available on OS X and Windows, so the the method returns a hard coded "true".
On Linux (resp. X11) this is not always true:
bq. from the docs:
The QSystemTrayIcon class can be used on the following platforms: [...] All window managers for X11 that implement the freedesktop.org system tray specification, including recent versions of KDE and GNOMESome old fashioned window managers don't have it. Thus it must be determined at run time and for that the window system has to be set up before with QApplication.