Adding dialog boxes

There are times when an application needs to inform the user of an action or to receive input for further processing. Usually, another window, typically small in size, will appear with such information or instructions. In Qt, the QMessageBox provides us with the functionality to raise alerts and receive input using QInputDialog.

There are different messages, as explained in the following table:

To raise an instance of QMessage to communicate a recently accomplished task to the user, the following code listing can serve as an example:

QMessageBox::information(this, tr("RMS System"), tr("Record saved successfully!"),QMessageBox::Ok|QMessageBox::Default, ...

Get Getting Started with Qt 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.