PDA

View Full Version : problem in QProgressBar setStyleSheet



wagmare
27th April 2009, 09:18
hi friends,

in dialog.cpp


progressbar = new QProgressBar();
label1 = new QLabel("please wait ...");
progressbar->setTextVisible(false);

//for progressbar
setStyleSheet("QProgressBar {border: 1px solid grey; border-radius: 8px;padding: 1px }");

//for chunk
setStyleSheet("QProgressBar::chunk {background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 white); }");



but here only one stylesheet is working at a time ... it QProgressBar::chunk stylesheet only works in my code .. if i commented the QProgressBar::chunk stylesheet ,, QProgressBar style sheet is working ... how can i modify both at a time ...?
please help ..

spirit
27th April 2009, 09:35
it happens because you override the first style sheet.
join these styles in one string and then set this string.

wagmare
27th April 2009, 10:00
it happens because you override the first style sheet.
join these styles in one string and then set this string.

thanks for reply .. yes its overriding the first style sheet and now i try like this



setStyleSheet(" QProgressBar {border: 1px solid grey;
border-radius:8px;padding:1px},
QProgressBar::chunk {background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 white);
width: 10px;margin: 0.5px}");


and its not working ... what i should use to separate the two stylsheets ... .

wagmare
27th April 2009, 10:03
sorry to post again .. remove the comma "," between the two style sheets ... its working