Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 PyQGIS 设计表格小部件中,我已将表格小部件设置为只读,当我选择特定时,它没有读取该行?
self.dlg.ui.tableWidget.item(row, 1).setFlags(Qt.NoItemFlags)
无法选择表格小部件中的行来读取数据。
您只需要使用按位运算来拒绝标志Qt.ItemIsEditable
Qt.ItemIsEditable
it = self.dlg.ui.tableWidget.item(row, 1) it.setFlags(it.flags() & ~Qt.ItemIsEditable)