QT under Tablewidget in order to make a column can not be edited what to do??? It is best to use a button control to control2012-03-31 19:57 Nanshan Poplar | Category: Other programming Languages | browse 2,658 times Share to: 2012-04-01 16:29The questioner is adopted byEnthusiastic netizens
Modify the column of the item's flags. For example:
#include <QApplication>
#include <QTableWidget>
#include <QTableWidgetItem>
int main (int argc, char **argv)
{
Qapplication app (argc, argv);
int col = 0;
Qtablewidget *table = new Qtablewidget (5, 3);
Table->setitem (0, col, New Qtablewidgetitem (QString ("Test"));
int i;
for (i = 0; i < Table->rowcount (); i++) {
Qtablewidgetitem *item = Table->item (i, COL);
if (item) {
Item->setflags (Item->flags () & (~qt::itemiseditable));
} else {
item = new Qtablewidgetitem;
Item->setflags (Item->flags () & (~qt::itemiseditable));
Table->setitem (i, col, item);
}
}
Table->show ();
return App.exec ();
}
QT under Tablewidget in order to make a single column can not edit what to do?