QTreeView和QDataWidgetMapper交互
所以我有一个 QTreeView witdget 连接到一个模型,并且相同的模型连接到一个 QDataWidgetMapper 对象,该对象连接到几个 LineEdits。我的问题是,当我单击 QTreeView 中的另一个项目时,我无法弄清楚如何更改 QDataWidgetMapper 索引...
我尝试了此连接:
i = QtCore.QModelIndex()
self.ui.MyQTree.clicked(i).connect(self.MyDataMapper.setCurrentIndex(i))
但它不起作用......我得到一个:
类型错误:本机 Qt 信号不可调用
真的是我束手无策了......
So I have a QTreeView witdget connected to a model, and the same model connected to a QDataWidgetMapper object which connects to a few LineEdits. My problem is that I can't figure out how to change the QDataWidgetMapper index when I click on another item in the QTreeView...
I tried this connect:
i = QtCore.QModelIndex()
self.ui.MyQTree.clicked(i).connect(self.MyDataMapper.setCurrentIndex(i))
But it doesn't work...I get a:
TypeError: native Qt signal is not callable
Really at the end of my rope here...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法将方法执行的结果连接为槽,但您可以尝试。
您需要做的是:
当“单击”触发时该视图将提供的索引将被传输到插槽。
You cannot connect the result of method execution as slot, but you try.
What you need to do is:
and the index, that view will provide when 'clicked' fires will be transferred to slot.