[SOLVED] Put application on notification bar.
-
Hello is there anyway to hide and put application on notification bar?
-
Use QSystemTrayIcon
-
@Hamed-Masafi I'm really thank you for your help. Do you know how to hide and application if user click on close bt on the top-right of the windows ?
-
@mcosta Hello, thank for help :) let me apology for less education with c++ i just start today. I have append the code MainWindow.cpp
void MainWindow::closeEvent(QCloseEvent *event){
}
And i got error message
no 'void MainWindow::closeEvent(QCloseEvent*)' member function declared in class 'MainWindow'I'm thank for help
-
*@mcosta Hello i have put void closeEvent(QCloseEvent); on the protected line of my header file. And the run look successfully however. i got error message when i try to use event->ignore(); in
void MainWindow::closeEvent(QCloseEvent *event){
QMessageBox::information(this, "Comfirmed", "We will hide your application");
if(QMessageBox::Ok){
event->ignore();
}
} -
Your code should be like this
void MainWindow::closeEvent(QCloseEvent *event){ int result = QMessageBox::information(this, "Comfirmed", "We will hide your application"); if(QMessageBox::Ok == result) { event->ignore(); } }
anyway is better to post also the error.
-
Update:
C:\Users\vibolvireak\Documents\Clossdrive\mainwindow.cpp:25: error: invalid use of incomplete type 'class QCloseEvent'
event->ignore();
^