Skip to content
Advertisement

How to inject widgets between QHeaderView and QTableView?

I would like to display widgets between the QHeaderView and the rest of the QTableView, like in the example picture below (created with Photoshop), as this seems like a natural way to enable input for filtering columns.


Does anybody have any ideas of how to inject widgets inbetween?


enter image description here

Advertisement

Answer

Below is a demo of a FilterHeader class that I wrote for one of my own projects. You will probably need to adapt it to suit your own needs, but it should already do most what you want. The padding around the filter boxes is unlikely to work the same on all platforms, so you may need to tweak the code in the adjustPositions method.

screenshot

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement