how to set QProgressDialog. progress indicator color?
Printable View
how to set QProgressDialog. progress indicator color?
Do you mean the progress bar on the QProgressDialog? If so, you can set its palette Highlight color to the color you want.
Maybe QProgressDialog constructs the progress bar with a default bar. To replace it just create a new QProgressBar* , change its color and replace it with setBar ( QProgressBar * bar )
Code:
QPalette palette1; brush2.setStyle(Qt::SolidPattern); brush3.setStyle(Qt::SolidPattern); myBar->setPalette(palette1); MyProgressDialog.setBar(myBar);
Carlos
You can use a style sheet
Carlos, I tried what you suggested in a class that is derived from QProgressBar. This is my code:
But the color doesn't change. Maybe you can spot my mistake?Code:
void MyProgressBar::onStarted() { setFormat(tr("Preparing")); greenBrush.setStyle(Qt::SolidPattern); this->setPalette(p); }