Empty space shown next to progress bar in QProgressDialog
-
I have a
QProgressDialogin my application. I have hidden the text of the progress bar in that dialog, but there's an empty space on the right side of that progress bar.This is what I did:
QLabel *label = new QLabel("Sync with entities started by user: " + szUser + ". Please wait..."); label->setStyleSheet("color:rgb(255,255,255);" "font-size: 15px;" "border: 1px solid rgb(72,72,72)"); progressDialogSync.setStyleSheet("QProgressDialog {" " background-color:rgb(72,72,72);" " padding: 20px;" " border: 3px solid rgb(50,50,50);" " border-radius: 5px;" "}" "QProgressBar {" " border: 2px solid white;" " padding: 1px;" "}"); progressDialogSync.setCancelButton(nullptr); progressDialogSync.setLabel(label); progressDialogSync.setMinimum(0); progressDialogSync.setMaximum(0); progressDialogSync.setAutoClose(true); progressDialogSync.resize(progressDialogSync.width(), 100); progressDialogSync.setWindowFlags(Qt::FramelessWindowHint); progressDialogSync.setWindowModality(Qt::ApplicationModal); QProgressBar *bar = progressDialogSync.findChild<QProgressBar *>(); bar != nullptr ? bar->setTextVisible(false) : void(); while(bSyncInProgress) { progressDialogSync.exec(); }And this is how it looks:

How do I get rid of that empty space so that my progress bar is either centered or takes up the width of the dialog box.
-
@JoeCFD I'm on Windows 10 using Qt 5.13
I created a clean project and used the same code, and there was no empty space on the right. Then I checked if my project had a stylesheet set for the QProgressBar in general in the ".qss" file. Turns out someone before me had set there a margin on the right side of the progress bar. Removing that resolved my problem. Only if I checked that a little sooner.
-
I have a
QProgressDialogin my application. I have hidden the text of the progress bar in that dialog, but there's an empty space on the right side of that progress bar.This is what I did:
QLabel *label = new QLabel("Sync with entities started by user: " + szUser + ". Please wait..."); label->setStyleSheet("color:rgb(255,255,255);" "font-size: 15px;" "border: 1px solid rgb(72,72,72)"); progressDialogSync.setStyleSheet("QProgressDialog {" " background-color:rgb(72,72,72);" " padding: 20px;" " border: 3px solid rgb(50,50,50);" " border-radius: 5px;" "}" "QProgressBar {" " border: 2px solid white;" " padding: 1px;" "}"); progressDialogSync.setCancelButton(nullptr); progressDialogSync.setLabel(label); progressDialogSync.setMinimum(0); progressDialogSync.setMaximum(0); progressDialogSync.setAutoClose(true); progressDialogSync.resize(progressDialogSync.width(), 100); progressDialogSync.setWindowFlags(Qt::FramelessWindowHint); progressDialogSync.setWindowModality(Qt::ApplicationModal); QProgressBar *bar = progressDialogSync.findChild<QProgressBar *>(); bar != nullptr ? bar->setTextVisible(false) : void(); while(bSyncInProgress) { progressDialogSync.exec(); }And this is how it looks:

How do I get rid of that empty space so that my progress bar is either centered or takes up the width of the dialog box.
Would love some input on this
-
Would love some input on this
@ScleaverZer0ne what is your Qt version? And OS?
-
@ScleaverZer0ne what is your Qt version? And OS?
@JoeCFD I'm on Windows 10 using Qt 5.13
-
@JoeCFD I'm on Windows 10 using Qt 5.13
I created a clean project and used the same code, and there was no empty space on the right. Then I checked if my project had a stylesheet set for the QProgressBar in general in the ".qss" file. Turns out someone before me had set there a margin on the right side of the progress bar. Removing that resolved my problem. Only if I checked that a little sooner.
-
S ScleaverZer0ne has marked this topic as solved on