View Full Version : styling controls inside QTreeView

11th May 2011, 15:39
In my application I use QTreeView that contains progressbar items inside its cells. Progressbar controls are drawn inside QStyledItemDelegate::paint procedure in the following way:

QStyleOptionViewItemV4 optionV4 = option;
initStyleOption(&optionV4, index);
QStyle * style = optionV4.widget->style();
QStyleOptionProgressBarV2 progressOpt;
progressOpt.orientation = Qt::Horizontal;
style->drawControl(QStyle::CE_ProgressBar, &progressOpt, painter);

Is it possible to change the style of such progressbar controls with qss?

12th May 2011, 07:56
No, I don't think so. There is no qss selector that would allow to reach widgets inside itemview cells. It might work if you set a global stylesheet for ALL progress bars but there are no guarantees.

27th May 2011, 19:25
I need the exact same thing. I tried setting a global style sheet for all progress bars, but the progress bars in the QTreeWidget are unchanged. I attached a sample project that shows what I tried (progressTest.zip).

It seems like there should be a way to do this. Are we really out of luck?