PDA

View Full Version : changing column width of QTableWidget



juliarg
22nd March 2007, 06:28
Hello everyone! I'm new to QT and using QT 4.4.2. I wonder why I can't change the width of columns in QTableWidget. I'm trying to do it like this:

ui.setupUi((QMainWindow *)this);
ui.tableWidget->horizontalHeaderItem(3)->setSizeHint(QSize(1000, 100));
QSize sh = ui.tableWidget->horizontalHeaderItem(3)->sizeHint();

The height of the row does really change to 100. The horisontal sizeHint is set to 1000, but the width doesn't change. Can someone help me, pls? Is there another way to change column width?

high_flyer
22nd March 2007, 10:01
should QTableView::setColumnWidth () help?

juliarg
22nd March 2007, 14:19
This is a QTableVew method, not QTableWidget.

high_flyer
22nd March 2007, 14:21
Have you heard of inheritance?
http://doc.trolltech.com/4.2/qtablewidget-members.html

juliarg
22nd March 2007, 15:51
Oh, I see. Wasn't attentive enough :o