Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSystemTrayIcon disappears on UBuntu 20.04/22.04 after reboot
Forum Updated to NodeBB v4.3 + New Features

QSystemTrayIcon disappears on UBuntu 20.04/22.04 after reboot

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 150 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anshah
    wrote on last edited by anshah
    #1

    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.

    Here's my implementation. This function is called on initialization:

    // Create tray and setup tray icon
    void MyApp::createTrayIcon()
    {
        QString trayImgStr = TRAY_IMG;
    
        m_pTrayIconMenu = new QMenu(this);
        m_pTrayImage    = new QPixmap(trayImgStr);
        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)));
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you check that the pixmap is created successfully on these platform ?

      On a side note, there's no need to created your QPixmap object on the heap.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved