Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Position of QMessageBox : centered on screen
boelraty last edited by
I'm using a QMessageBox inside a Widget. The object is build during main widget constructor and I'm using slots to show/hide the QMessageBox.
I'm experiencing trouble with the QMessageBox position. The first time "show" is called, the box is well centered. Next time, the box is moved to the top left of the screen and move / setGeometry methods don't work to replace it at widget center.
How can I keep my box on screen center ?
Thank you. Best.
Jeroentjehome last edited by
The QMEssagebox is always centered on the parent. The first time the parent is probably set correctly. How it reacts after that is a mystery to me, I never show/hide a QMessageBox, but only create one within a certain scope with modal set (blocking all other inputs to the program) and then when the user clicks a button/closes the messagebox the QMessageBox goes out of scope, releasing it's memory.