系统托盘



//托盘  
	QIcon icon = QIcon("icon/icon.png");
	this->setWindowIcon(icon);
	tray = new QSystemTrayIcon(this);

	tray->setIcon(icon);
	tray->setToolTip("KKPlayer");

	connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slot_tray(QSystemTrayIcon::ActivationReason)));


void MainWindow::slot_tray(QSystemTrayIcon::ActivationReason reason)
{
	//触发后台图标执行相应事件  
	switch (reason)
	{
	case QSystemTrayIcon::Trigger:/*单击*/
	{
									  tray->hide();
									  this->show();
	}
	default:
		break;
	}
}


你可能感兴趣的:(系统托盘)