Search code examples
pythonpyqtqaction

How to make toggle-able QAction


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)?


Solution

  • 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.