PDA

View Full Version : Position of QMessageBox



Raadush
2nd August 2012, 15:02
I quite dont understand this issue. I have this part of code:



x=500;
y=500;
message->move(x,y);
message->exec();
r=p11manipulator->thread.functionReturned;

if(!r)
{
message->move(x,y);
message->exec();


message is created in constructor of my class with message = new QMessageBox(this); and "this" is QMainWindow. When I call message->exec() for the first time, it is placed somewhere (500,500 i hope), but for the second time, it jumps slightly higher. Why is that?

Qtonimo
2nd August 2012, 15:19
Don't create a QMessageBox in Construcor of your MainWin....

tescrin
2nd August 2012, 17:29
If you're going to call it at the start of the code (and also somewhere else) wrap the thing in a function and go from there.

If it's still moving then IIRC you can pass a QPoint to the .exec command to have it pop up where you want. I do this for menus so they pop up where my cursor is instead of in the same position all the time.