Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Add combobox in Header View
Qt 6.12 LTS is out! See what's new in the release blog

Add combobox in Header View

Scheduled Pinned Locked Moved General and Desktop
qtableviewqtablewidgetqheaderviewdelegate
3 Posts 2 Posters 3.9k Views 2 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Requirement : The combobox look and feel should be present at all times (not just on double click).
    The table data should not be altered. Kindly let me know if there is a better approach.
    I have tried certain ways:

    1. Reimplementation of QHeaderView : it would result in static controls which are immovable in horizontal scroll
    2. Added delegates : but tableview->horizontalHeader()->setDelegateItem doesnot seem to work
    3. Adding delegates : Upon forcefully adding comboboxes in tableview first row (first row data is getting compramised), the model class will override my combobox selection when i "setmodal". And the combobox selection will not stick if I reimplement paint method.
      Thanks in Advance.
      I would Like to add a snapshot as well. But I am not sure how to add here.
      Kindly let me know the same
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Have a look at this blog post. It looks exactly like your use case.

      Hope it helps

      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
      • SGaistS SGaist

        Hi and welcome to devnet,

        Have a look at this blog post. It looks exactly like your use case.

        Hope it helps

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @SGaist
        Hi SGaist! Thanks for reply!
        I had tried this and it will result in static controls being placed on header.
        Upon Horizontal scroll to right/left, it will appear immovable.
        Thanks for the info though!

        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
        • Unsolved