darpan
18th October 2006, 14: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
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