How to have a progressbar in an item of a listwidget?
-
So I want the items in my listwidget to have the title of the item (e.g) Curtainsup.mp3 and near that have a progressbar..
For example if I would like to create a music player and near the current song have a progressbar about the percentage that is completed.. When the song ends, the progressbar should not be removed but the text of it change to completed and go to next item with progressbar again...I think my idea is a widget that is kinda look like excel in windows, you know where you can resize the the boxes.. don't know..
Thanks for any answer! -
Hi guys,
It depends on the use of "Model/View" or "item based" views. If using the item based you can simply create a progressbar and use the list.addItem() function to add the progressbar. The progressBar itself is not able to handle the custom text in it. Then you have to rewrite the QProgressBar into a custom widget (inherit QProgressBar) and add that item to the list.
If you are using the "model/view" I would suggest reading the spinBox example (http://doc.qt.nokia.com/4.7-snapshot/itemviews-spinboxdelegate.html)
Hope this helps. -
I found a solution :)
@
QProgressBar *prog=new QProgressBar(this);
ui->tableWidget->setCellWidget(0 ,0 ,prog);prog->setValue(27);
@
-
I think using "QxtItemDelegate":http://libqxt.bitbucket.org/doc/0.6/qxtitemdelegate.html is a much better solution...