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. Customizing QComboBox dropdown

Customizing QComboBox dropdown

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 600 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.
  • krzysieklfcK Offline
    krzysieklfcK Offline
    krzysieklfc
    wrote on last edited by
    #1

    Hello

    I want QComboBox dropdown to contain a special 'Create new' option just like in the image below. My ComboBox view is a custom QTableView, not a simple list.

    I'm not very familiar with lower-level drawing APIs and I would like to pick the right tool for the job right from the start.
    Any recommended approach I should take to implement this?

    Thanks

    Untitled.jpg

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QStyledItemDelegate comes to mind for that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      krzysieklfcK 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        QStyledItemDelegate comes to mind for that.

        krzysieklfcK Offline
        krzysieklfcK Offline
        krzysieklfc
        wrote on last edited by krzysieklfc
        #3

        @SGaist Thanks for responding.

        While drawing seems pretty straightforward, how do I correctly extend the viewport boundaries so the new drawn rectangle is visible? I can't find an example of how to do that.
        Is it all doable in QStyledItemDelegate or do I need to play with sizeHint etc.?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          There might be several ways. You could implement a custom view which paints in a larger view port.

          Or have that last item be a normal item and react on it when clicked.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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