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:
- making sizehintrole in headerData in my model and return my own size;
- changing setSectionResizeMode to ResizeToContent
- setting every column's width with and without resize modes through "setColumnWidth"
- making my own delegate with sizehint overloading with my wanted size
- setting stylesheet with padding 0px; to QTableView, QTableView::section, QTableView::item
- using "header->setDefaultSectionSize"
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.