Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to uncheck the action on the toolbar

How to uncheck the action on the toolbar

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 609 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by
    #1

    Hi all

    I found the action could not be uncheck on the tool bar.
    I set QActionGroup::setExclusive(true) the put the actions into, then set QAction::setCheckable(true).

    the last action can be uncheck the last action when other actions checked, but it can not be uncheck if I press the same again.

    Must I make a slot to setchecked(false)?

    Best regards
    Mihan

    Gojir4G 1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      If you've set QActionGroup::setExclusive(true), I think even setChecked(false) won't be able to uncheck it.

      1 Reply Last reply
      0
      • MihanM Mihan

        Hi all

        I found the action could not be uncheck on the tool bar.
        I set QActionGroup::setExclusive(true) the put the actions into, then set QAction::setCheckable(true).

        the last action can be uncheck the last action when other actions checked, but it can not be uncheck if I press the same again.

        Must I make a slot to setchecked(false)?

        Best regards
        Mihan

        Gojir4G Offline
        Gojir4G Offline
        Gojir4
        wrote on last edited by
        #3

        Hi @Mihan,

        You should probably set exclusion policy to QActionGroup::ExclusionPolicy::ExclusiveOptional

        actionGroup.setExclusionPolicy(QActionGroup::ExclusiveOptional)
        
        MihanM 1 Reply Last reply
        1
        • Gojir4G Gojir4

          Hi @Mihan,

          You should probably set exclusion policy to QActionGroup::ExclusionPolicy::ExclusiveOptional

          actionGroup.setExclusionPolicy(QActionGroup::ExclusiveOptional)
          
          MihanM Offline
          MihanM Offline
          Mihan
          wrote on last edited by
          #4

          @Gojir4 said in How to uncheck the action on the toolbar:

          QActionGroup::ExclusionPolicy::ExclusiveOptional

          Thanks a lot. it seems I must upgrade the Qt to 5.14
          So does it meen I must setChecked(false) by myself in lower version?

          Gojir4G 1 Reply Last reply
          0
          • MihanM Mihan

            @Gojir4 said in How to uncheck the action on the toolbar:

            QActionGroup::ExclusionPolicy::ExclusiveOptional

            Thanks a lot. it seems I must upgrade the Qt to 5.14
            So does it meen I must setChecked(false) by myself in lower version?

            Gojir4G Offline
            Gojir4G Offline
            Gojir4
            wrote on last edited by
            #5

            @Mihan said in How to uncheck the action on the toolbar:

            So does it meen I must setChecked(false) by myself in lower version?

            Yes.

            1 Reply Last reply
            0
            • MihanM Mihan has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved