PDA

View Full Version : QTreeWidget - preventing columns from being resized.



sternocera
13th September 2007, 16:44
Hello,

I'm developing an embedded application using qtopia core (which is functionally identical to qt4), and I don't want the user to be able to resize a column of my QTreeWidget. I've been settings column widths in this manner:


headings << "Description" << "Qty" << "Unit price" << "Total price";
mymainscreen.treeWidget_products->setHeaderLabels(headings);
mymainscreen.treeWidget_products->setColumnWidth(0,360);
mymainscreen.treeWidget_products->setColumnWidth(1,32);
mymainscreen.treeWidget_products->setColumnWidth(2,72);
mymainscreen.treeWidget_products->setColumnWidth(3,72);
mymainscreen is a ui object, so the QTreeWidget pointer, "treeWidget_products" is "instantiated" there.

I want to prevent the objects columns from being resized. How is this possible?

I've already figured out how to remove the cursor, because it's a touchscreen system:


QApplication::setOverrideCursor(QCursor(Qt::BlankC ursor) );

Thanks in advance,
Sternocera

jpn
13th September 2007, 17:11
See QHeaderView::setResizeMode(). You can access the header via QTreeView::header().