-1

In PyQGIS design tablewidget, I have set table widget to be read-only and when I select particular,it is didn't read that row?

self.dlg.ui.tableWidget.item(row, 1).setFlags(Qt.NoItemFlags)

unable to select rows in table widget,to read datas.

ucMedia
  • 4,105
  • 4
  • 38
  • 46
  • you could explain yourself better, place an appropriate title, and take advantage of giving more details, you have a lot of space, please read [ask], it is difficult to understand what you want. – eyllanesc Apr 05 '18 at 04:07
  • Nothing i will just simply tell you,i set the tablewidget in pyqt as readonly and i cannot able to select any row,so please tell me there is any option to read the rows in readonly mode itself. – BalajiSriram S Apr 05 '18 at 04:14
  • From what I understand, you do not want the cells to be editable, but they can be selected. I am right? – eyllanesc Apr 05 '18 at 04:16
  • yes right,can you suggest me any solution for this? – BalajiSriram S Apr 05 '18 at 04:22

1 Answers1

0

You just have to use bitwise operations to deny the flag Qt.ItemIsEditable

it = self.dlg.ui.tableWidget.item(row, 1)
it.setFlags(it.flags() & ~Qt.ItemIsEditable)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241