通过在Python中拥有行号和列号,在单元格表小部件中找到一个值
我在Python中有一个QT表小部件,在其中找到了行号,最后一项的列号以这种方式更改:
class elencoviaggi(QtWidgets.QDialog):
def __init__(self):
super(elencoviaggi, self).__init__()
uic.loadUi('elenco_viaggi.ui', self)
self.tabella_registrazioni.setColumnWidth(0, 30)
self.tabella_registrazioni.setColumnWidth(1, 100)
self.botton = self.findChild(QtWidgets.QPushButton, 'pushButton_3')
self.botton.clicked.connect(self.salva) !
def salva(self):
print(self.tabella_registrazioni.itemChanged.connect(self.changeIcon))
def changeIcon(self, item):
row = item.row()
col = item.column()
在代码的这一部分中,我通过按钮正确找到行编号和列号的列号用户更改了最后一项,我如何存储在具有0列0的项目中,并以“行”变量为行?我尝试了此tabella_registrazioni.item(行,0),但不起作用。 我不知道使用行和列号找到项目的命令是什么
I have a QT Table Widget in python where I find the row number and the column number of the last item changed by the user in this way :
class elencoviaggi(QtWidgets.QDialog):
def __init__(self):
super(elencoviaggi, self).__init__()
uic.loadUi('elenco_viaggi.ui', self)
self.tabella_registrazioni.setColumnWidth(0, 30)
self.tabella_registrazioni.setColumnWidth(1, 100)
self.botton = self.findChild(QtWidgets.QPushButton, 'pushButton_3')
self.botton.clicked.connect(self.salva) !
def salva(self):
print(self.tabella_registrazioni.itemChanged.connect(self.changeIcon))
def changeIcon(self, item):
row = item.row()
col = item.column()
In this part of the code I correctly find through a button the row number and the column number of the last item changed by the user, how can I store in a variable the item that has column 0 and as row the "row" variable declared? I tried this tabella_registrazioni.Item(row, 0) but doesn't work.
I don't know what is the command to find an item using row and column numbers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果某人有同样的问题,则命令是:
If someone has the same issue the command is :