Question

Basically I'm learning the basics of Qt C++ and I'm trying to open up two different QMessageBox's at the same time but they overlap each other. I was wondering if it was possible to have them side by side. Any input on how to do so would be greatly appreciated.

Extra information: I'm opening them by using the QMessageBox::name(this,"Title", "Text") way.

Was it helpful?

Solution

You can use QMessageBox::move(int x, int y) to place the message box where you want on the screen. You can also use QMessageBox::setGeometry(int x, int y, int width, int height).

OTHER TIPS

That does not really make sense. QMessageBox is not for arbitrary windows, but specifically for modal dialogs. The user cannot interact with two modal dialogs. Anyway, I don't see anything in the documentation that would allow you to align message boxes or set coordinates etc.

Edit: As Marian noted, there is the move method of QWidget. This might work, but I would not recommend it. Modal dialogs are usually not presented side by side. This might confuse the user.

If you really need two windows side by side, non-modal (custom) windows or dock widgets might be a better solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top