void Window::changeEvent ( QEvent * event ){ if (event->type() == QEvent::WindowStateChange) { if (windowState() == Qt::WindowMinimized) qApp->postEvent(this, new QCloseEvent()); }}
C++ (Qt)void sb_pipeline2::changeEvent(QEvent * event) { if(event->type() == QEvent::ActivationChange) { if(isVisible() && isMinimized()) { event->ignore(); hide(); return; } } QMainWindow::changeEvent(event);}
void MainWindow::changeEvent (QEvent *event){ if ((event->type() == QEvent::WindowStateChange) && isMinimized() && systemTrayIcon->isVisible() &&) { QTimer::singleShot(0, this, SLOT(hide())); event->ignore(); } else QMainWindow::changeEvent(event);}