我试着自己写一个关于菜单栏的快捷方式示例,但是我遇到了一些问题。
我在菜单栏上有一个File(&F)
,在File(&F)
中有一个保存文件(Ctrl+S)项,我想知道为什么我不能在按Alt + F
后使用Ctrl + S
的快捷方式
menuBar = self.menuBar()
fileMenu = menuBar.addMenu("&File")
self.fileMenu .addAction(self.SaveFileBt)
self.SaveFileBt.setShortcut("Ctrl+S")
Tags:
在下面的示例中,有三种方法可以调用
save
操作按相应的菜单项,如图所示
使用键盘快捷键
Ctrl+S
使用键盘快捷键
Alt+F+S
相关问题 更多 >
编程相关推荐