Important: Please read the Qt Code of Conduct -

QAction Disabled in a Toolbar can not be Checked?

  • I added a QAction to a toolbar through a QToolbutton.

    Setting the action as checkable enabled me to set it as checked and everything worked great until I wanted to marked it as checked and disabled.
    At this point the action was indeed marked as disabled but the checked indication was removed. It looked as if the button is flat. can the checkable state be shown only when the action is enabled?

    Thank you for any ideas

  • It is actually shown as both checked and disabled, but the only difference is that the contents of the button has been slightly shifted. That is too subtle to notice.

    There are two ways around it, and both have disadvantages:

    create a proxy style to render the button differently in this case.

    use a style sheet do define your own styling.

Log in to reply