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 13 Jan 2022, 17:15 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?

    J 1 Reply Last reply 13 Jan 2022, 20:47
    0
    • S StarterKit
      13 Jan 2022, 17:15

      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?

      J Offline
      J Offline
      JonB
      wrote on 13 Jan 2022, 20:47 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 14 Jan 2022, 06:42
      0
      • J JonB
        13 Jan 2022, 20:47

        @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 14 Jan 2022, 06:42 last edited by
        #3

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

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 14 Jan 2022, 06:54 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 14 Jan 2022, 07:04
          1
          • C Christian Ehrlicher
            14 Jan 2022, 06:54

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

            S Offline
            S Offline
            StarterKit
            wrote on 14 Jan 2022, 07:04 last edited by
            #5

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

            J 1 Reply Last reply 14 Jan 2022, 08:39
            1
            • S StarterKit
              14 Jan 2022, 07:04

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

              J Offline
              J Offline
              JonB
              wrote on 14 Jan 2022, 08:39 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

              1/6

              13 Jan 2022, 17:15

              • Login

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