[Solved] Make QTableWidget cells Read Only?
-
Hi,
I have a QTableWidget in my dialog.
I have created QTableWidgetItem objects & set them as item for cells in the QTableWidget.
I am setting the text in the items by setText() by code.
I want to make my cells read only. I do not want the user to modify any cell in any circumstance.
How do I do that?
I could not find a function for this neither in QTableWidget nor in QTableWidgetItem.
Thank You. -
Hi,
You have to set the item "flags":http://qt-project.org/doc/qt-4.8/qtablewidgetitem.html#setFlags using "Qt::ItemFlag":http://qt-project.org/doc/qt-4.8/qt.html#ItemFlag-enum
Hope it helps
-
Thank You SGaist!
That works fine :) -
In Qt Creator you can set NoEditTriggers in EditTriggers group of QAbstractItemVIew section