Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.5.3, 6.6.0
-
None
-
-
c1d389a13 (dev), 8fcd3b1b1 (6.6), 350025e93 (tqtc/lts-6.5)
Description
See simple example TrayIconTestMacBug.zip
#include "mainwindow.h" #include "./ui_mainwindow.h" #include <QSystemTrayIcon> #include <QMenu> #include <QPushButton> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); trayMenu = new QMenu(this); trayMenu->addAction(tr("Quit"), qApp, &QCoreApplication::quit); trayIcon = new QSystemTrayIcon(QPixmap(":/banana.png"), this); trayIcon->setContextMenu(trayMenu); trayIcon->show(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { if (trayIcon->contextMenu()) { trayIcon->setContextMenu(nullptr); ui->pushButton->setText("Add Tray Menu"); } else { trayIcon->setContextMenu(trayMenu); ui->pushButton->setText("Remove Tray Menu"); } }
trayIcon->setContextMenu(nullptr) has no effect.
Just launch it and click on tray icon (Banana) - menu is displayed - OK
Press on 'Remove Tray Menu' button and click on tray icon again - menu is still displayed - BUG.
Attachments
Issue Links
- relates to
-
QTBUG-119065 Unable to reset tray icon menu for QML SystemTrayIcon
- Closed
For Gerrit Dashboard: QTBUG-119068 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
517689,4 | QSystemTrayIcon: Allow resetting context menu | dev | qt/qtbase | Status: MERGED | +2 | 0 |
517748,2 | QSystemTrayIcon: Allow resetting context menu | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
517765,2 | QSystemTrayIcon: Allow resetting context menu | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |