Hi,
How to set the TableWidgetItem As readonly ?
Bye
Hi,
How to set the TableWidgetItem As readonly ?
Bye
When I had to do a non editable QTableWidget I used QTableView instead.
But maybe you can do it just setting the flag Qt::ItemIsSelectable for each QTableWidgetItem.
kavinsiva (23rd October 2009)
Or this code might help
QTableWidgetItem *newItem = new QTableWidgetItem(tr(""));
newItem->setFlags( Qt::ItemIsEnabled );
This flag setting will make the Table Widget item Non Editable, and the widget will be enabled.
kavinsiva (23rd October 2009)
You probably want to remove the Qt::ItemIsEditable and Qt::ItemIsUserCheckable flags from the item potentially preserving the others (e.g if the item is a tristate check box or draggable).
kavinsiva (23rd October 2009)
But if you remove the flags Qt::ItemIsEditable and Qt::ItemIsUserCheckable the table changes it visibility... the text of each cell appears like "disabled" (gray) and it's not intuitive.
That's why I had to use QTableView instead.
kavinsiva (23rd October 2009)
Hi Thankyou to Your reply,
I found some way to set as readonly
Qt Code:
newItem2->setFlags(newItem2->flags() & (~Qt::ItemIsEditable));To copy to clipboard, switch view to plain text mode
it set particular cell as Read only
Bookmarks