在OSX 10.10上打开菜单时,Qt系统托盘图标消失

时间:2014-12-29 16:07:14

标签: c++ macos qt system-tray

我有简单的qt代码:

sticon = new QSystemTrayIcon(this);
QIcon icon(":/music.png");
sticon->setIcon(icon);

QMenu* stmenu = new QMenu(NULL);
action = new QAction("test",NULL);
stmenu->addAction(action);
sticon->setContextMenu(stmenu);
sticon->show();
connect(action, SIGNAL(triggered()), this, SLOT(clickText()));

当我点击菜单时,我收到错误并且托盘图标消失:

QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setCompositionMode: Painter not active
QPainter::end: Painter not active, aborted

适用于OSX 10.10 + Qt 5.4 有什么问题?

1 个答案:

答案 0 :(得分:0)

这是Qt 5.4 bug:

  

在Mac OS X 10.9.5上,运行Qt中包含的QSystemTrayIcon示例   安装。单击菜单栏上显示的图标以激活   菜单。然后单击其他位置以停用它。图标变为空白   菜单栏。如果再次单击空白区域,则会显示图标   再次出现。

https://bugreports.qt-project.org/browse/QTBUG-42910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel