Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to have a progressbar in an item of a listwidget?
Forum Updated to NodeBB v4.3 + New Features

How to have a progressbar in an item of a listwidget?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leon
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        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.

        Greetz, Jeroen

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexandros
          wrote on last edited by
          #4

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

          prog->setValue(27);
          

          @

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            I think using "QxtItemDelegate":http://libqxt.bitbucket.org/doc/0.6/qxtitemdelegate.html is a much better solution...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved