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. Is it possible to disable shortcuts usage for a widget?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to disable shortcuts usage for a widget?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 544 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    StarterKit
    wrote on last edited by StarterKit
    #1

    Hi,
    I have a descendant class from QTabBar. It works fine but I need some buttons to have an ampersand (&) symbol in title. When I use this symbol it automatically makes next letter a shortcut. But this behaviour disturbs other things and I would like to switch this option. But I have no idea is it feasible or not.

    Yes, I know that I may put double && and it will be converted into a single one without shortcut. But it disturbs things in another place - I use the same string in different places and this extra ampersand also bad for me. I.e. I'll need to have 2 copies of each string - with single and double ampersands.

    Does anyone know better/simler way to prevent QTabBar from creating shortcuts?

    JonBJ 1 Reply Last reply
    0
    • S StarterKit

      Hi,
      I have a descendant class from QTabBar. It works fine but I need some buttons to have an ampersand (&) symbol in title. When I use this symbol it automatically makes next letter a shortcut. But this behaviour disturbs other things and I would like to switch this option. But I have no idea is it feasible or not.

      Yes, I know that I may put double && and it will be converted into a single one without shortcut. But it disturbs things in another place - I use the same string in different places and this extra ampersand also bad for me. I.e. I'll need to have 2 copies of each string - with single and double ampersands.

      Does anyone know better/simler way to prevent QTabBar from creating shortcuts?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @StarterKit said in Is it possible to disable shortcuts usage for a widget?:

      Yes, I know that I may put double && and it will be converted into a single one without shortcut. But it disturbs things in another place - I use the same string in different places and this extra ampersand also bad for me. I.e. I'll need to have 2 copies of each string - with single and double ampersands.

      This is the only correct thing to do. You do not (should not) want to solve your issue by disabling shortcuts.

      S 1 Reply Last reply
      0
      • JonBJ JonB

        @StarterKit said in Is it possible to disable shortcuts usage for a widget?:

        Yes, I know that I may put double && and it will be converted into a single one without shortcut. But it disturbs things in another place - I use the same string in different places and this extra ampersand also bad for me. I.e. I'll need to have 2 copies of each string - with single and double ampersands.

        This is the only correct thing to do. You do not (should not) want to solve your issue by disabling shortcuts.

        S Offline
        S Offline
        StarterKit
        wrote on last edited by
        #3

        @JonB, ok, thanks for opinion. I'll go this way.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Or write a small function which removes the ampersand when you retrieve the text for the tabbars.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          S 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            Or write a small function which removes the ampersand when you retrieve the text for the tabbars.

            S Offline
            S Offline
            StarterKit
            wrote on last edited by
            #5

            @Christian-Ehrlicher exactly :) Finally I overrode AddTab method to duble & in incoming strings.

            JonBJ 1 Reply Last reply
            1
            • S StarterKit

              @Christian-Ehrlicher exactly :) Finally I overrode AddTab method to duble & in incoming strings.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @StarterKit said in Is it possible to disable shortcuts usage for a widget?:

              Finally I overrode AddTab method to duble & in incoming strings.

              I did not suggest this because it means you cannot deliberately set any shortcut for any tab item. So long as you are happy with that behaviour then it is OK. @Christian-Ehrlicher's suggestion does not suffer from this issue, since you would only substitute && to &, leaving any deliberate shortcuts in place. As you please.

              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