Connect action in QMainWindow with method of view's delegate (PySide/Qt/PyQt)

喜欢而已 提交于 2019-11-29 15:41:14

I think from a design point of view the top window is a sort of global. You have already described a behaviour which is treating it in that way and (as ekhumoro has said) that pretty much requires you to provide access to that top window to the editor.

One very simple way to do that is to call parent.window() in the createEditor method. Maybe something like:

parent.window().boldTextAction.triggered.connect(editor.toggleBold)

That seems to work for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!