PDA

View Full Version : Custom progress bar background for list items



themagician
26th February 2012, 13:50
I'd like to draw a custom background for items in a table widget that shows a visual representation of some progress. Maybe some pseudocode will explain it better:


CustomProgressBar pb;
pb.setColor(LIGHT_GREEN); // set progress bar color to light green
pb.setHeight(100); // consume 100% of space vertically
pb.setWidth(30); // consume 30% of space horizontally
pb.setAutoResize(true); // resize progress bar if parent item is resized

QListWidgetItem *newItem = new QListWidgetItem;
newItem->setBackground(pb);
newItem->setText("My Movie Watchlist (30% Completed)");

Here's what it's supposed to look like with HTML/CSS: http://jsfiddle.net/wShQR/

What do I need in order to do this?

Thanks.

wysota
26th February 2012, 22:07
A custom delegate.