PDA

View Full Version : QTableWidgetItem's setFlags() ???



darpan
18th October 2006, 15:45
Hi
I have a QTableWidget placed on a form using QT4 Designer and it has three columns. First column item is checkable.

Following code is used to insert row items in QTableWidget


row = tableWidget->rowCount(); // current row count
tableWidget->setRowCount(row+1); // add one row


item=new QTableWidgetItem(SearchHeaderEnd->bSoftwareName);
item->setFlags ( Qt::ItemIsUserCheckable );
item->setFlags(Qt::ItemIsSelectable );

if(SearchHeaderEnd->IfSelected)
item->setCheckState ( Qt::Checked );
else
item->setCheckState ( Qt::Unchecked );
tableWidget->setItem( RowCount, 0, item );

item=new QTableWidgetItem(SearchHeaderEnd->bFileExt);
tableWidget->setItem( RowCount, 1, item );


FileSize= FileSize.setNum(SearchHeaderEnd->dwFileSize/1024);
item=new QTableWidgetItem(FileSize);
tableWidget->setItem( RowCount, 2, item );


Size = Size - sizeof(HEADER_FILE);
RowCount++;



My Problem is:
(1) Item appears as disabled of first column and rest of the two columns are editable

How to set the item->setFlags () so that it appear checkable,selectable,not editable.


Thanks and regards

jpn
18th October 2006, 16:07
My Problem is:
(1) Item appears as disabled of first column and rest of the two columns are editable

How to set the item->setFlags () so that it appear checkable,selectable,not editable.

I already gave you answer (http://www.qtcentre.org/forum/f-qt-programming-2/t-make-each-row-of-table-widget-not-editable-4049.html#5) to this.