Add combobox in Header View



  • 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

  • Lifetime Qt Champion

    Hi and welcome to devnet,

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

    Hope it helps



  • @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!



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.