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.8k 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 21 Jan 2018, 21:30 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

    M 1 Reply Last reply 21 Jan 2018, 21:43
    0
    • S scotryder
      21 Jan 2018, 21:30

      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

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 21 Jan 2018, 21:43 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 23 Jan 2018, 02:22
      4
      • M mrjj
        21 Jan 2018, 21:43

        @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 23 Jan 2018, 02:22 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?

        M 1 Reply Last reply 23 Jan 2018, 10:12
        0
        • S scotryder
          23 Jan 2018, 02:22

          @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?

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 23 Jan 2018, 10:12 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 23 Jan 2018, 12:34
          3

          1/5

          21 Jan 2018, 21:30

          • Login

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