Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.
QDialog position flickers with move command
I create a custom QDialogBox class and try to display it in the centre of my window using the 'move' command. The dialog box appears at a random position on the screen and then moves to the position set by me after 1 second. This happens at random instances on mac machine. Is this a Qt problem with mac? is there a workaround?
CustomDialog *loginDialog = new CustomDialog( this );//a QDialogBox class float width=350,height=180; dialogBoxPosition(&width, &height); _mFinalPoint.setX(width); _mFinalPoint.setY(height); loginDialog->move(_mFinalPoint);//moving it to a window center loginDialog->loginWindow();//calling a member function loginDialog->exec();
May I ask you why you use float for width and height?
What is dialogBoxPosition() doing?
What is loginDialog->loginWindow() doing?
Thank you for the reply.
- I just used float. Should I use any other type.
- Dialog box position calculates values for width and height
- loginwindow is a member function which displays some buttons inside the QDialog box.
Using float does not make sense because width and hight in a QWidget are integer types, so you have useless type conversions.
Could it be a move-animation on OS X which takes time?
I changed all the floats to int but the problem still persists. The move command moves the box to the required position but the default position of the box is something else. How can I set this default position? I also tried using setGeometry but the same problem exists.
Something along these lines should work and be simpler:
QRect dialogGeometry = loginDialog->geometry(); dialogGeometry.moveCenter(geometry().center()); loginDialog->setGeometry(dialogGeometry); loginDialog->exec();
Note that your loginDialog construction is a bit unusual, why not build all the UI inside its constructor ?
Hi, I tried using this code and I also tried to set geometry inside the constructor but I am facing the same problem. The dialog box appears for a fraction of section in one location and then it moves to the location set by me.
Another thing, I was able to solve this problem in Qt Creator. However, when I try to run the same code in Xcode(mac machine), I see this flickering. Could it be a qt mac problem?
What version of Qt and OS X are you running ?
qt version 5.5.
OS X 10.10
Xcode version 6
Can you share a sample code that reproduce that ?