I have two QTableView with own simple models. After making the following:
tv1->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
tv1->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
tv1->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
tv1->resizeColumnsToContents();
I have this picture:
And here what I want:
What I've tried:
Nothing of these works. I am desperate enough to draw the table from zero with QPainter or follow every source file to watch the real size. But before that, I would appreciate for any advice.
You can try setting the minimum section size to zero for the horizontal header, this way:
tv1->horizontalHeader()->setMinimumSectionSize(0);
(Docs here).