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. QAction still triggered by keyboard shortcut when disabled.

QAction still triggered by keyboard shortcut when disabled.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 603 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    Hello!

    In qt-5.11.0 it looks like a disabled QAction will still be triggered by typing its keyboard shortcut. The docs say otherwise.

    Any thoughts on this? I am using the main menu for QMainWindow on macOS.

    Thanks!

    https://alaskafamilysystems.com/

    K 1 Reply Last reply
    0
    • P patrickkidd

      Hello!

      In qt-5.11.0 it looks like a disabled QAction will still be triggered by typing its keyboard shortcut. The docs say otherwise.

      Any thoughts on this? I am using the main menu for QMainWindow on macOS.

      Thanks!

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @patrickkidd

      Probably you need to show the code snippet on the section disabling the keyboard shortcut.

      Also did you rerun qmake and a rebuild?

      Vote the answer(s) that helped you to solve your issue(s)

      P 1 Reply Last reply
      2
      • K koahnig

        @patrickkidd

        Probably you need to show the code snippet on the section disabling the keyboard shortcut.

        Also did you rerun qmake and a rebuild?

        P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        @koahnig Yes, I have cleaned the project for sure.

            allActionsEnabled = self.activeLicense() is not None
            actions = \
                self.ui.menuFile.findChildren(QAction) + \
                self.ui.menuEdit.findChildren(QAction) + \
                self.ui.menuView.findChildren(QAction) + \
                self.ui.menuInsert.findChildren(QAction)
            for action in actions:
                if action != self.ui.actionQuit:
                    action.setEnabled(allActionsEnabled)
        

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0

        • Login

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