Working with dialog boxes

One very important aspect of creating a user-friendly application is the ability to display vital information regarding the status of the application when a certain event (intended or unintended) occurs. To display such information, we need an external window that can be dismissed by the user once he/she has acknowledged the information.

Qt comes with this functionality, and it's all residing in the QMessageBox class. There are several types of message box you can use in Qt; the most basic one uses just a single line of code, like so:

QMessageBox::information(this, "Alert", "Just to let you know, something happened!"); 

There are three parameters you need to provide for this function. The first one is the parent ...

Get Hands-On GUI Programming with C++ and Qt5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.