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. QTabBar disable auto shortcuts
Forum Updated to NodeBB v4.3 + New Features

QTabBar disable auto shortcuts

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 912 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.
  • E Offline
    E Offline
    Evan Teran
    wrote on last edited by
    #1

    Hi,

    I have an application which has a lot of shortcuts, many of them able to be specified by the user. For historical reasons, some of these shortcuts are Alt+<Key> based.

    Additionally, my application uses tabs as the primary interface, and I have run into an issue that I can't seem to work around.


    QTabBar seems to auto-magically create keyboard shortcuts for the tab, even though they do not have any & characters in them.

    For example, if I have two tabs with the text: Untitled and Untitled_1, the result is that the first tab is connected to a shortcut of Alt+U and the second is connected to Alt+1. This is in contrast to the documentation which says I should expect this behavior if the text was &Untitled and Untitled_&1.

    Also, QKeySequence::mnemonic is, in fact, returning an empty QKeySequence object for the tab text being provided; so I don't understand where these shortcuts are coming from :-/. I have tried playing with qt_set_sequence_auto_mnemonic to no success. If I wrap operations which create/update tabs with:

    qt_set_sequence_auto_mnemonic(false); 
    // do work
    qt_set_sequence_auto_mnemonic(true);
    

    I see no difference in behavior. Alternatively, if I just do qt_set_sequence_auto_mnemonic(false) at program start, this does seem to disable the shortcuts in the tabs... but also breaks all my menu shortcuts (dispite still displaying the underlines as if they would work!)

    Is there a solution that will let me disable these keyboard shortcuts in a QTabBar without me having to roll an entirely custom one?

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Evan Teran
      wrote on last edited by
      #2

      I found the culprit, and it is not Qt's fault, it is KDE's!

      Apparently KDEPlatformTheme will automatically adjust accelerators... which personally, I don't like. It can be worked around with:

      [Development]
      AutoCheckAccelerators=false
      

      In ~/.config/kdeglobals

      I will look for a better solution, but in the KDE forums ;-).

      aha_1980A 1 Reply Last reply
      4
      • E Evan Teran

        I found the culprit, and it is not Qt's fault, it is KDE's!

        Apparently KDEPlatformTheme will automatically adjust accelerators... which personally, I don't like. It can be worked around with:

        [Development]
        AutoCheckAccelerators=false
        

        In ~/.config/kdeglobals

        I will look for a better solution, but in the KDE forums ;-).

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi @Evan-Teran,

        Glad you found a workaround. It would nevertheless be nice to report back here when you get more information. Others may be interested in this topic also.

        Thanks

        Qt has to stay free or it will die.

        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