Re: QSystemTrayIcon sometimes can’t show

  • Sorry that I'm creating new topic but I couldn't post new answer in my topic (click scrolled web page to the top). It is related to:

    Unfortunately problem still exists. I have this problem on my virtualbox KDE 32bit system. Seems that it occur when application starting slowly (I have limited RAM for this system so my application has slow start). On this system trayicon doesn't work on each start. My friend which have Xubuntu (XFCE) also confirmed that sometimes trayicon is show in left-top corner instead of tray bar. I'm also assigning context menu to tray icons. Is it possible that I'm doing something in wrong order?
    This is my main proc (I'm creating tray icon here because this solved problem on my main physical system)

    @int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QtSingleApplication app(argc, argv);
    if (app.isRunning()) {
        QMessageBox::information(0, "Player", "Another instance is running");
        return 0;
    QSystemTrayIcon *t = new QSystemTrayIcon();

    #if defined(Q_OS_LINUX)

    MainWindow w;;
    w.mTray = t;
    return a.exec();
    delete t;


    And this is proc createTray in main window:
    @void MainWindow::createTray()
    QList<QAction *> l;
    l << ui->actionPlay << ui->actionStop << ui->actionNext << ui->actionPrevious;
    connect(mTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.