...QSystemTrayIcon *trayIcon;...MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ... trayIcon=new QSystemTrayIcon; connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); trayIcon->setIcon(QIcon(":/new/prefix1/ico"));}void MainWindow::on_pushButton_9_clicked(){ hide(); trayIcon->show();}