samedi 27 mai 2017

QProgressDialog QLabel not aligning after show

I am trying to have a single QProgressDialog with different QLabel for different parts of my program so that i can show the percentage of different actions.

The problem i'm having is that if i do the following:

QProgressDialog progress("doing this", "abort", 0, INT_MAX, this);
progress.setWindowModality(Qt::WindowModal);
progress.setMinimumWidth(600);
progress.setMinimumDuration(0);

QLabel *progres_title = new QLabel("doing that",this);
progres_title->setAlignment(Qt::AlignCenter);
progress.setLabel(progres_title);

progress.show();
progress.setValue(0);

(change the label title before the show) the new doing that label is centered on the progress bar but if i move

QLabel *progres_title = new QLabel("doing that",this);
progres_title->setAlignment(Qt::AlignCenter);
progress.setLabel(progres_title);

under the show the label text gets updated correctly but it won't remain aligned center but move to the left instead.

How can i keep the new label text aligned center?

Aucun commentaire:

Enregistrer un commentaire