PDA

View Full Version : Resizing headers view in the QTableWidget



jano_alex_es
26th January 2010, 13:16
Hi, I am having a strange bahavour and I'd like to ask you if somebody understand why.

I have a QTableWidget called m_tbl.


ui.m_tbl->setColumnCount(3);
ui.m_tbl->horizontalHeader()->setStretchLastSection(true);
ui.m_tbl->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
ui.m_tbl->horizontalHeader()->setResizeMode(0, QHeaderView::Fixed);
ui.m_tbl->horizontalHeader()->setDefaultSectionSize(25);

From the docs, setDefaultSectionSize says: "This property holds the default size of the header sections before resizing.
This property only affects sections that have Interactive or Fixed as their resize mode."

As far as a I understand, this means my first column should have width 25, the second resize to its contents and the third fill the hole table.

BUT what I get are two columns with 25 od width and the last one doing setStretchLastSection() normally.

thanks!

jano_alex_es
27th January 2010, 11:55
so I guess this code should work and I should look for my problem in somewhere else.