0

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.

demonplus
  • 5,613
  • 12
  • 49
  • 68
user3183586
  • 167
  • 1
  • 5
  • 15

2 Answers2

1

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.

Sebastian Negraszus
  • 11,915
  • 7
  • 43
  • 70
1

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).

jaho
  • 4,852
  • 6
  • 40
  • 66