Nominate our 2022 Qt Champions!

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!

  • I have a similar question. I think it is something with custom delegate but i don't know how to make something like this..

  • 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 (
    Hope this helps.

  • I found a solution :)
    QProgressBar *prog=new QProgressBar(this);
    ui->tableWidget->setCellWidget(0 ,0 ,prog);



  • I think using "QxtItemDelegate": is a much better solution...

Log in to reply