Qt creator, error message

I'm a little rusty with QT, but I had to use it for projects before.

I was wondering if I can create a popup, a small window with height / width disabled so that the user cannot expand it. It should also lock the screen until it clicks a button in this window.

I could do it all in a separate class, but I was interested. Are there any built-in QT classes that have a small popup that I could just change? I mean, creating a class just for reporting an error seems a bit wasteful to me. I try to keep the project small.

But if a class is required to do this, that's fine. The only problem is that I don’t know how to lock the application windows so that you need to do one thing before you can return to the main application.

I am not asking someone to print all this code for me, just give me a link or something else. I was looking for him, but I could not find him. Greetings.

+8
c ++ user-interface qt
source share
3 answers
QMessageBox messageBox; messageBox.critical(0,"Error","An error has occured !"); messageBox.setFixedSize(500,200); 

The above code snippet will provide the required message box.

+27
source share

For a simple error message, I suggest you look into the QMessageBox (the documentation contains a small example that should show you how easy it is to achieve what you need), which is also modal. You can use QDialog to display a simple error message, but maybe too much for such a simple task.

+4
source share

I believe that what you are looking for is something like QDialog . Dialogues can be modal or modeless. The modal dialog blocks the interaction with the calling window until the dialog is processed.

You can either subclass QDialog, or check if one of the default dialog classes is enough for what you need.

+2
source share

All Articles