Pyqt Hide/Remove QAction Menu from toolbutton

问题内容:

self.find_next_ret_act = QtWidgets.QAction(triggered=self.toolButton_5.animateClick)
self.find_next_ret_act.setShortcut(QtGui.QKeySequence("Return"))
self.find_next_enter_act = QtWidgets.QAction(triggered=self.toolButton_5.animateClick)
self.find_next_enter_act.setShortcut(QtGui.QKeySequence("Enter"))
self.toolButton_5.addActions([self.find_next_ret_act, self.find_next_enter_act])

I am using PyQt5 and I was trying to set couple of shortcuts to one tool button but it didn’t work except with the QAction workaround but the problem now is that I want to hide the QAction menu that appears when I hold the tool button down, is there any way to do so?

Thanks,

Max

问题评论:

原文地址:

https://stackoverflow.com/questions/47755788/pyqt-hide-remove-qaction-menu-from-toolbutton

Add a Comment