python - Hide an action without disabling it -
i need control gui shortcuts, created actions assign shortcuts. however, have put actions in menu (so visible) enable them. , of action basic, change tab, , don't deserve appear in menu.
is there way hide them without disabling them ?
self.changetabaction.setvisible(false)
this line hides action, disables it.
just add widget addaction
. added widget wont visible. here example:
import sys pyside import qtgui, qtcore class window(qtgui.qwidget): def __init__(self): super(window, self).__init__() action = qtgui.qaction(self) action.setshortcut('ctrl+t') action.triggered.connect(self.on_triggered) self.addaction(action) def on_triggered(self): print('triggered') app = qtgui.qapplication(sys.argv) w = window() w.show() sys.exit(app.exec_())
Comments
Post a Comment