Unsolved Add styles to a QMessageBox
-
Hi,
Since it looks it's happening at application startup, I would go with QSplashScreen.
-
@SGaist Unfortunately it doesn't happen at startup. it happens in 3 moment after triggering some button
-
Well, you can still use it there. Or a QProgressDialog with an infinite progress bar.
-
@mrjj I tried doing something like
msgBox.setStylesheet("color: red;")
but it didn't respond. Can you explain the other option a little more? Thanks -
@SGaist I tried first with the progress bar but I have no way to fill it, and leaving it empty also looks bad.
Screen Shot 2020-04-29 at 15.22.47.png -
@maria-v
Hi
Try
msgBox.setStyleSheet("background-color: rgb(255, 0, 0);");
and it should turn red.Both QSplashScreen and QProgressDialog would also be good options as @SGaist mentions.
What i was talking about was a UI form QDialog made with the wizard.
and you get a new UI where you can add a label or other elements to make it look 100% as you wish.
-
@maria-v said in Add styles to a QMessageBox:
@SGaist I tried first with the progress bar but I have no way to fill it, and leaving it empty also looks bad.
Screen Shot 2020-04-29 at 15.22.47.pngIf you put the same value for min and Max, you'll have an infinite bar.
-
@SGaist said in Add styles to a QMessageBox:
infinite bar
What do you call "infinite bar"? I tried
progress.setMinimum(0); progress.setMaximum(0); progress.setValue(0);
and in Windows got
-
Cann't you just use a QLabel to do that?
I'm using a QLabel showing "Loading" when the ui is loading for seconds.
Seems you don't need any interactive functions.
And it is easy to be customized with stylesheet. -
@maria-v said in Add styles to a QMessageBox:
What do you call "infinite bar"? I tried progress.setMinimum(0); progress.setMaximum(0); progress.setValue(0); and in Windows got
I know this as "pulsing progress bar". However, you need to process incoming events occasionally in order to have that pulsating bar. The easiest (though not the preferred way) is to put QApplication::processEvents() in several places which will allow the progress dialog to update.