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 Do I set widgets in listView ?
Forum Updated to NodeBB v4.3 + New Features

How Do I set widgets in listView ?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 803 Views 2 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.
  • mit_cruzeM Offline
    mit_cruzeM Offline
    mit_cruze
    wrote on last edited by
    #1

    I want to add widgets like pushbuttons in listview items. How to?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Best way is via a delegate.
      http://doc.qt.io/qt-5/model-view-programming.html
      It will then just draw the look of a button but
      when in Edit mode it will be real button.
      The easy way is
      http://doc.qt.io/qt-5/qabstractitemview.html#setIndexWidget
      but performance will suck at some point. ( many rows)
      so also depends on your requirements.

      1 Reply Last reply
      1
      • mit_cruzeM Offline
        mit_cruzeM Offline
        mit_cruze
        wrote on last edited by
        #3

        Is there any small example for this?

        mrjjM 1 Reply Last reply
        0
        • mit_cruzeM mit_cruze

          Is there any small example for this?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @mit_cruze
          Hi
          http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
          You would draw a button instead of start but concept is the same.

          The setIndexWidget should is one liner and docs should be fine?
          http://stackoverflow.com/questions/5184956/using-a-qwidget-in-a-qt-view

          1 Reply Last reply
          1

          • Login

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