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. QT Widget ListView with Custom Designed Items
Forum Updated to NodeBB v4.3 + New Features

QT Widget ListView with Custom Designed Items

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 6.9k 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.
  • S Offline
    S Offline
    scotryder
    wrote on last edited by
    #1

    Hi there,

    Hi can i use Widget based List Control with custom layouted/designed items?
    Which control should i use, how ill set my custom designed widget to be used as template for list items to appear?

    alt text

    Thanks

    mrjjM 1 Reply Last reply
    0
    • S scotryder

      Hi there,

      Hi can i use Widget based List Control with custom layouted/designed items?
      Which control should i use, how ill set my custom designed widget to be used as template for list items to appear?

      alt text

      Thanks

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

      @scotryder

      Hi
      Normally you would use a delegate to draw it as you want it to look
      http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
      (this is kinda a trick as it only draws as widgets until you edit the row, then its
      live widgets. but it has good performance.)

      Alternatively for only a FEW items, one can use
      http://doc.qt.io/qt-5/qlistwidget.html#setItemWidget
      (and a ListWidget )
      Here we simply put a live widget on top of the row item.
      This has bad performance with many items and on small boards/phones.

      Alternatively for a few items, you can use
      a QScrollArea.

      In most cases you will be most happy with a model and a view and a delegate as you can share the model with more views and its fast.

      S 1 Reply Last reply
      4
      • mrjjM mrjj

        @scotryder

        Hi
        Normally you would use a delegate to draw it as you want it to look
        http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
        (this is kinda a trick as it only draws as widgets until you edit the row, then its
        live widgets. but it has good performance.)

        Alternatively for only a FEW items, one can use
        http://doc.qt.io/qt-5/qlistwidget.html#setItemWidget
        (and a ListWidget )
        Here we simply put a live widget on top of the row item.
        This has bad performance with many items and on small boards/phones.

        Alternatively for a few items, you can use
        a QScrollArea.

        In most cases you will be most happy with a model and a view and a delegate as you can share the model with more views and its fast.

        S Offline
        S Offline
        scotryder
        wrote on last edited by
        #3

        @mrjj Thank you for your reply, i tried to understand stardelegate example but its bit overwhelming for me as a new user.
        So my question is Cant we use visual custom widget as a delegate instead of overriding Paint method and design it with pure code?

        mrjjM 1 Reply Last reply
        0
        • S scotryder

          @mrjj Thank you for your reply, i tried to understand stardelegate example but its bit overwhelming for me as a new user.
          So my question is Cant we use visual custom widget as a delegate instead of overriding Paint method and design it with pure code?

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

          @scotryder
          The setItemWidget can be used to inset a widget ( with subwidgets ) on a item but
          its not possible to use as a delegate as such.
          This method is very easy but also a bit heavy with many items.
          But on a desktop class pc. many items is maybe a thousands.
          So if app is not to run on smartphone/ Pi boards then it works pretty ok.
          However, the delegate and painting is best in terms of memory use and performance.

          S 1 Reply Last reply
          3

          • Login

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