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. Problems with QMenu and QSystemTrayIcon on macOS

Problems with QMenu and QSystemTrayIcon on macOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 33 Views
  • 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.
  • O Online
    O Online
    Oleh Herashchenko
    wrote last edited by
    #1

    I have small system tray application like this:

    TrayApp::TrayApp(QObject *parent) : QObject(parent)
    {
        m_trayIcon = new QSystemTrayIcon(this);
    
        m_trayMenu = new QMenu();
        m_subMenu = new QMenu("Submenu", m_trayMenu);
        connect(m_trayMenu, &QMenu::aboutToShow, this, &TrayApp::rebuildTrayMenu);
        m_trayIcon->setContextMenu(m_trayMenu);
        m_trayIcon->show();
    }
    
    void TrayApp::rebuildTrayMenu()
    {
        m_trayMenu->clear();
    
        m_subMenu->addAction("Action_1");
        m_subMenu->addAction("Action_2");
    
        m_trayMenu->addMenu(m_subMenu);
        m_trayMenu->addSeparator();
        m_trayMenu->addAction(tr("Exit"), this, &TrayApp::onExitTriggered);
    }
    

    When I open subMenu for the first time (from the moment of launch until opening subMenu, no menu elements were activated) the entire menu disappears. I tried Python - same result. Qt 6.10.2, macOS 26.3

    1 Reply Last reply
    0

    • Login

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