PDA

View Full Version : QTableWidget resize



MarkoSan
12th January 2008, 17:46
How do I resize QTableWidget?? I simply cannot find method name ... :confused::o

The Storm
12th January 2008, 18:02
Like every other widget
resize() - to resize it
move() - to move it
setGeometry() - to resize and move it from one call.
:)

MarkoSan
12th January 2008, 18:20
god damn, today i'm so stupid .... thnaks man

MarkoSan
12th January 2008, 18:33
But this resize() has no effect, I've inserted QTableWidget on parent widget via horizontal layout ... How to set width of QTableWidget so ScrollBar dissapears. How do I sum all header widths?

The Storm
13th January 2008, 00:07
Depends how items you have you can calculate one item pixels and then just count them and resize the QTableWidget as much as you need. Maybe Qt have better way for that but I don't know it. :)

jpn
16th January 2008, 11:21
Widgets managed by layouts are not resizable by hand. Layout resizes widgets based on their size hints, size policies, min/max sizes etc. You might want to subclass QTableWidget and reimplement sizeHint() to return a suitable size hint so that the table doesn't have to show scroll bars. Both QTableView and QHeaderView contain methods to calculate required size.

MarkoSan
16th January 2008, 14:00
I've set widget to be fixed size and and then I've called setFixedSize and now works!

jpn
16th January 2008, 14:05
What if the end-user has larger font than you?

MarkoSan
16th January 2008, 14:18
Hmm, I was just thinking in your way, your remark is very good, thanks, but I have no idea how to reimplement sizeHint, I do not know what to put in this method ... Will do it your way, thanks.