PDA

View Full Version : Change position (X/Y coordinates) the progress bar in a QProgressDialog



tanmayb
14th August 2017, 15:55
Hello all,

I am new to Qt programming.

In my project, I am using standard QProgressDialog. But the progress bar inside that dialog is aligned at the bottom section along with a Cancel button. I want to move the progress bar or the button to some distance from each other.

I tried with

findChildren<QProgressBar>().move(5,10);

but it doesn't work.

Does anybody knows how to approach it and find a solution.

Many thanks in advance!

d_stranz
16th August 2017, 17:09
The QProgressBar's position and size are almost certainly under the control of a QLayout within the dialog, and therefore cannot be moved or sized manually. If you don't like the default arrangement, then your only option is probably to implement your own progress dialog that is laid out according to your preferences.

You *might* be able to add space between the progress bar and the cancel button by retrieving the QLayout from the dialog, finding the index of the QProgressBar within the layout, and then adding a QSpacerItem after that index. But that's just a guess and seems like a distraction to getting work done on what your project is really about.