QSystemTrayIcon disappears on Ubuntu 20.04/22.04 after reboot

21 Views Asked by At

My Qt Application shows the QSystemTrayIcon on fresh install but after reboot or logout/login I see the QSystemTrayIcon disappears from UI on startup.

I am seeing this issue on 20.04 and 22.04. 18.04 works no issues.

My implementation is straightforward. This function is called on initialization:

// Create tray and setup tray icon
void MyApp::createTrayIcon()
{
    QString trayNotConn = TRAY_IMG;

    m_pTrayIconMenu = new QMenu(this);
    m_pTrayImage    = new QPixmap(trayNotConn);
    m_pTrayIcon     = new QSystemTrayIcon(this);

    QIcon icon(*m_pTrayImage);
    m_pTrayIcon->setIcon(icon);
    setWindowIcon(icon);
    m_pTrayIcon->show();

    connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
               this,     SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
}

I'm aware that Gnome has stopped supporting system tray icons and I'm using Top Icons Extension on 20.04. I still see the issue on reboot inspite of this.

0

There are 0 best solutions below