Hi, here is a solution, and I think it works quite well in my application:

In the dialog's slot that connects with the activated() signal of the QSystemTrayIcon object, use the setParent() function as:
Qt Code:
  1. void FtpDialog::sysTrayActivated(QSystemTrayIcon::ActivationReason reason)
  2. {
  3. if (reason == QSystemTrayIcon::Trigger){
  4. setParent(NULL, Qt::Window);
  5. showNormal();
  6. sysTrayIcon->hide();
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

And in the dialog's event() function:

Qt Code:
  1. bool FtpDialog::event(QEvent *e)
  2. {
  3. if (e->type() == QEvent::WindowStateChange) {
  4. if (isMinimized()) {
  5. setParent(tmp, Qt::SubWindow);
  6. sysTrayIcon->show();
  7. e->ignore();
  8. qDebug()<<"event() called";
  9. } else {
  10. e->accept();
  11. }
  12.  
  13. }
  14. return QDialog::event(e); // return with QDialog's event() call anyway.
  15. }
To copy to clipboard, switch view to plain text mode 

Here, 'tmp' is an empty QWidget serving as a provisional 'parent' of the dialog, so that the dialog can be hidden from task-bar when minimized. In fact, you can just pass NULL as the first argument for the 'parent' widget, but in this case probably the re-stored window would exhibit slightly different with the original window size.