The above code doesn't display all the message. Only the last alert is visible. How to display all the alerts.Qt Code:
this->showMessage(tr("Alert"), str, icon); sleep(2); }To copy to clipboard, switch view to plain text mode
The above code doesn't display all the message. Only the last alert is visible. How to display all the alerts.Qt Code:
this->showMessage(tr("Alert"), str, icon); sleep(2); }To copy to clipboard, switch view to plain text mode
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
Wow, that will block your whole application! Better use a QTimer.
the output is same as previous.Qt Code:
this->showMessage(tr("Alert"), str, icon); sleep(2); }To copy to clipboard, switch view to plain text mode
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
because of your sleep(). First it is only possible to display one message. So if you have more you must place them with time elapse.
- Store all messages in a QQueue.
- call a showMyMessages(): if the queue in not empty and the timer is not running display the message and start a timer which calls the same function again in X seconds. if no message are left stop timer.
Bookmarks