I have a widget MyTable that contains a QTableWidget *table.
This QTableWidget has a header for the columns QHeaderView *header, given by
table->horizontalHeaderView()
Ok, now I want to draw a widget in the section n°1 of the header.
Currently, I use :
QWidget *widget(header);
widget->setGeometry(header->sectionPosition(1), 0, header->sectionSize(1), header->height());
The widget geometry is updated each time the header geometry change and each time the table->horizontalScrollBar() is changed.
The problem is that the current version is buggy because the widget seems not to be drawn taking in account the scrollbar position. Maybe I have to change the coordinates when I do widget->setGeometrybut I don’t know how…
How to take in account the position of the scrollbar to draw my widget at the correct position ?
Thank you very much.
Ok, solution found :