2

I have introduces a table in my ui file ,now what I want is that during run time the table values can only change due to internal algorithm but user is unable to make any change or select any cell externally.

How can I do that?

This question has been marked as duplicate but it is not as i mentioned before i want that that table should only update data/text via internal algorithm ,but once the text is updated that cell become accessible to external input

QTableWidgetItem *itm = new QTableWidgetItem();

itm->setFlags(itm->flags()^(Qt::ItemIsSelectable|Qt::ItemIsEditable));
ui->tableWidget->setItem(i,j,itm);

a this point user cant enter value externally,but once i do this:

QTableWidgetItem *itm = new QTableWidgetItem();
itm->setText("0.554");
ui->tableWidget->setItem(2,3,itm);

cell(2,3) becomes accessible to external input

m7913d
  • 10,244
  • 7
  • 28
  • 56
vasu gupta
  • 305
  • 1
  • 3
  • 11
  • Setting editTriggers to NoEditTriggers should do what you want. – Eelke Aug 25 '17 at 14:15
  • i don't get it how ll it work for my case – vasu gupta Aug 25 '17 at 14:27
  • Please update your question (including your title!) to remove all the parts of your question that are solved by the duplicate question? See [ask]. Avoid adding information to your question by adding comments, instead edit your original post. – m7913d Aug 28 '17 at 20:14

0 Answers0