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. Example of model/view with custom widget
QtWS25 Last Chance

Example of model/view with custom widget

Scheduled Pinned Locked Moved General and Desktop
model view progcustom widgetdrag and drop
3 Posts 2 Posters 2.2k Views
  • 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.
  • L Offline
    L Offline
    l1q1d56
    wrote on 22 Jun 2016, 14:35 last edited by
    #1

    Hi to all,
    I'm trying to create a imaging-like software but I'm stuck on the model view system. My idea is to create a model which contains on each row a layer with the parameters but I cannot find an example with something like this:
    https://s32.postimg.org/nc98he205/Untitled.png
    The first is a toggle button to switch visibility, the second is the alpha and the third is the layer name. Each line should be rearrangeable using drag and drop.

    Any snippet code/tutorial/example?

    J 1 Reply Last reply 22 Jun 2016, 14:40
    0
    • L l1q1d56
      22 Jun 2016, 14:35

      Hi to all,
      I'm trying to create a imaging-like software but I'm stuck on the model view system. My idea is to create a model which contains on each row a layer with the parameters but I cannot find an example with something like this:
      https://s32.postimg.org/nc98he205/Untitled.png
      The first is a toggle button to switch visibility, the second is the alpha and the third is the layer name. Each line should be rearrangeable using drag and drop.

      Any snippet code/tutorial/example?

      J Offline
      J Offline
      Joel Bodenmann
      wrote on 22 Jun 2016, 14:40 last edited by Joel Bodenmann
      #2

      What you're looking for is called "an item delegate". Documentation can be found here: https://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
      There are various examples available, most notably this one which shows how to use any custom widget in a view as an item delegate.

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      1
      • L Offline
        L Offline
        l1q1d56
        wrote on 23 Jun 2016, 06:49 last edited by
        #3

        Hi @Joel-Bodenmann , thank you, I got the point about the item delegate but I see two issues:

        • implement a drag and drop listview because I ended up with empty lines (on the list view) and fields on the widget mapper:
          https://s32.postimg.org/47yyrq7id/Untitled.png
        • implement a delegate that paint a checkbox with custom pixmap, the input with number and the input with text.
        1 Reply Last reply
        0

        1/3

        22 Jun 2016, 14:35

        • Login

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