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. Delegate Min/Max
Forum Update on Monday, May 27th 2025

Delegate Min/Max

Scheduled Pinned Locked Moved General and Desktop
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.
  • X Offline
    X Offline
    xris
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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
      0
      • X Offline
        X Offline
        xris
        wrote on last edited by
        #3

        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
        0

        • Login

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