Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Example of model/view with custom widget

    General and Desktop
    model view prog custom widget drag and drop
    2
    3
    1790
    Loading More Posts
    • 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.
    • l1q1d56
      l1q1d56 last edited by

      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?

      Joel Bodenmann 1 Reply Last reply Reply Quote 0
      • Joel Bodenmann
        Joel Bodenmann @l1q1d56 last edited by Joel Bodenmann

        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 Reply Quote 1
        • l1q1d56
          l1q1d56 last edited by

          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 Reply Quote 0
          • First post
            Last post