Qt Code:
  1. foreach (QString str, msgData) {
  2. QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon();
  3. this->showMessage(tr("Alert"), str, icon);
  4. QCoreApplication::processEvents(); // <= THIS LINE
  5. sleep(2);
  6. }
To copy to clipboard, switch view to plain text mode 
the output is same as previous.