View Full Version : Issue with QComboBox for QTableView horizontalHeader

28th August 2018, 14:27
I've implemented a QTableView based on this:


and the implementation referenced in the associated comments.

The result is a tableView where the horizontal header is a set of QComboBoxes. My specific code initializes the content of the boxes does some other custom stuff like disabling items in the boxes when they are the currentItem in boxes associated other columns.

It all works, except that the contents of the boxes don't show up unless a section is resized or the table is horizontally scrolled.

If I resize a section with the mouse, its box and all the boxes associated with columns to the right "get fixed". But those to the left remain empty. Like the sectionResized handler is doing the magic.

My subClassed combobox has handlers for signals sectionResized() and sectionMoved(), just like the reference article suggests. As a workaround, I've tried calling them from code after the tableView has been constructed. But, that doesn't fix the problem.

Also, I've tried calling resizeSection(int,int) from code, but for some reason the sectionResized() handler never gets called. (Both sectionResized and sectionMoved handlers get call properly when I use the mouse to resize or scroll).

I've tried adding update() and show() many places, but those don't seem to have any affect.

It's been driving me crazy. I'd be happy with a work-around with just doing something in code that does what I'm doing with a mouse!

17th September 2018, 20:33
Still no solution to this. I'm going to have to try something else.

17th September 2018, 20:41
Can you give a minimal compilable example that shows the problem?

Try hiding and reshowing the header.

17th September 2018, 22:41
hiding and reshowing the header didn't fix the issue.

Yes, I'll work on a minimal compilable example.

Dave Thomas