PDA

View Full Version : Qt 5 QSystemTrayIcon throws error message on Mac OS X



janusz
6th March 2013, 13:59
Hi all, I've created a simple app with system tray icon but seems like when using Qt 5 it throws an error message, but works. Maybe recipes that worked for Qt 4 on Mac OS X are not valid anymore for Qt 5?

Here's a code sample from Qt Creator:

Header (.h)

#include <QSystemTrayIcon>

Implementation (main.cpp)

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

return a.exec();
}

Implementation (pieces of mainwindow.cpp)


#include "mainwindow.h"
#include "ui_mainwindow.h"
#define TRAY_ICON ":/trayicon.png"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QIcon trayIcon = QIcon( TRAY_ICON );
QSystemTrayIcon *tray = new QSystemTrayIcon(this);
tray->setIcon(trayIcon);
tray->show();
}


When I start the app it throws this:

QObject::connect: No such slot QSystemTrayIcon::emitActivated(QPlatformSystemTray Icon::ActivationReason)

There is no such error message when compiled with Qt 4.8.4

strahlex
24th March 2013, 15:55
I get the same error in my application. Also some menu entries are missing.