Reputation: 19329
Is there a way to make QAction
stay down after it is clicked. Ideally it could toggle between two states: On
(down) and Off
(up)?
Upvotes: 0
Views: 2843
Reputation: 29463
What you are looking for is a toggle button. This is implemented in Qt via the checkable property: if an action is checkable, then when the action is in a button the button is a toggle button; when the action is in a menu item you see a checkmark; etc.
Upvotes: 1
Reputation: 19329
action = QtGui.QAction(QtGui.QIcon("myicon.png"),"Action Name", None)
action.setCheckable(True)
action.setStatusTip("Tooltip")
action.setShortcut("Ctrl+D")
action.triggered.connect(actionTrigged)
Upvotes: 1