Important: Please read the Qt Code of Conduct -

[OS X]: switching off icons in the "system tray" menu

  • On OS X, Qt 4.8.6 appears not to respect the IconVisibleInMenu QAction setting for members of a "System Tray" menu.

    This is easily shown with the systray example: change Window::createActions to

    void Window::createActions()
    minimizeAction = new QAction(tr("Mi&nimize"), this);
    qDebug() << "createActions" << minimizeAction << "icon=" << minimizeAction->icon() << "visible=" << minimizeAction->isIconVisibleInMenu();
    connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
    // ...

    and the console output will read

    createActions QAction(0x115355cd0) icon= QVariant(QIcon, ) visible= false

    but the minimise menu item will still have an icon.

    Is this a known issue in Qt4, with a known workaround? Where in the Qt4 code could I look to fix this, if a patch doesn't exist already?

  • Also, when playing with the Qt5 systray example, I noticed that this 5.3 does respect the icon visibility when adding an action, but I can't seem to get the visibility to change dynamically (while changing the icon image works just fine)?

Log in to reply