Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Delegate Min/Max

    General and Desktop
    2
    3
    1876
    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.
    • X
      xris last edited by

      I need to create a table that will contain multiple types of delegates; spinners, dropdowns, text, checkboxes, etc. Something like a Properties panel in an IDE.

      I think that the default delegates will be fine; I don't need anything fancy for presentation. I do need to be able to set the min/max for int values in the spinners as well as other validation on the values. Is there a way to do this without writing my own delegate or creating a new editor for QItemEditorFactory? I'd prefer to keep all business logic in the Model.

      I would think this would be a simple thing to set in the model, but I can't find it.

      1 Reply Last reply Reply Quote 0
      • A
        andre last edited by

        Look into one of the many property editors that are around. Personally, I use a modified YAPE (to be found on qt-apps.org), but there are others as well.

        1 Reply Last reply Reply Quote 0
        • X
          xris last edited by

          So, I ended up using UserRoles to get the data from the model to the delegate.

          I think there's a bug, however. When my delegate's createEditor is called, it is populated with the DisplayRole data, not the EditRole data. This makes for a problem with combo boxes. The DisplayRole is a string, but the EditRole is a list. I need that list type QVariant in the createEditor to create the right QWIdget.

          I've gotten around this by having another UserRole to ask for the type of component to create, but it would be a whole lot simpler if createEditor was sent the EditRole data.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post