异度部落格

学习是一种生活态度。

0%

Qt编程技巧 系统托盘设置

1
2
3
4
5
6
7
8
9
10
11
12
13
trayIcon = new QSystemTrayIcon(this);   //系统托盘

trayMenu = new QMenu(this); //托盘菜单
trayMenu->addAction(Action1);

......

trayMenu->addAction(quitAction10);

connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(show()));

trayIcon->setIcon(QIcon(":/icons/trayIcon.png"));
trayIcon->setContextMenu(trayMenu);