2023年12月2日发(作者:)
qt主窗口不在任务栏显示,在右下角托盘托盘 QSystemTrayIcon* qsys=new QSystemTrayIcon(this); qsys->setIcon(QIcon(":/titleCoin/Resources/bitbug_")); qsys->setToolTip(tr("柠檬")); QMenu* menu = new QMenu(this); QAction * actionWindow = new QAction("打开面板", this); menu->addAction(actionWindow); connect(actionWindow, &QAction::triggered, qw, &ShadowWindow::showNormal);//用要操作的窗口响应 QAction *actionClose = new QAction("退出",this); menu->addAction(actionClose); connect(actionClose,&QAction::triggered,qw, &ShadowWindow::close); qsys->setContextMenu(menu); qsys->show();
connect(qsys, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_activatedSysTrayIcon(QSystemTrayIcon::ActivationReason)));//响应图标点击事件,要槽函数void PWindow::on_activatedSysTrayIcon(QSystemTrayIcon::ActivationReason reason) { if (reason == QSystemTrayIcon::Trigger) { qw->showNormal(); }}隐藏任务栏图标#include "stdafx.h"#include "QtGuiApplication1.h"#include


发布评论