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. ItemView (QHeaderView)
Forum Updated to NodeBB v4.3 + New Features

ItemView (QHeaderView)

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.7k 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.
  • I Offline
    I Offline
    Immii
    wrote on last edited by
    #1

    Hi there, can any one please give me some code snippet how can I add a combBox in my listview header.
    I am also thinking since qheaderview is a widget why cant I subclass it and put combobox in layout and set that layout in this header? or am I thinking weird

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      you are thinking weired.

      Yes, it is a widget
      Yes it is a view

      If you just add a combo box, it is not shown in the headers.
      A herader view is a QAbstractItemView, so you can use an item delegate for that or any other view method from that class.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Immii
        wrote on last edited by
        #3

        @Gerolf: Indeed me too realized it is weired idea. so I endup writing itemDelegate and re implemented few virtual function including createEditor() and returned comboBox as editor but this has no effect but then I read the details of the Qt document of Qheaderview and that says that itemDelegate will not work with headerview.
        Now I am lost, only thing I can read here and there is to paint the section but I dont know how to do that and even if I manage to paint who is going to manage the items of the combobox and many other signals and slot etc of a general combobox you can think of.

        Guys any idea? code snippet ? example? pointer?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Indeed, Gerolf's suggestion was off. You cannot use delegates for header views.

          The only thing you can do, is create the combo box as a child of the HeaderView, and position it manually. QHeaderView has some functions that allow you to figure out where each section of the header is, and what their sizes are.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Immii
            wrote on last edited by
            #5

            Andre, Thanx this largely works

            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