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. QPushButton in QMessageBox missing key shortcut underline on initial display
Forum Updated to NodeBB v4.3 + New Features

QPushButton in QMessageBox missing key shortcut underline on initial display

Scheduled Pinned Locked Moved Solved General and Desktop
qpushbuttonqmessageboxshortcutunderline
24 Posts 4 Posters 16.7k Views 2 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.
  • kshegunovK kshegunov

    @Harry123
    I'd say the default is determined by the OS settings, and Qt simply wouldn't presume to override it. That'd explain why when you change the settings systemwide the behavior changes accordingly.

    H Offline
    H Offline
    Harry123
    wrote on last edited by Harry123
    #21

    @kshegunov

    I don't think this is a system default, since Qt paints its buttons itself and does not use native widgets.
    I say this because if I look into a Qt dialog using Spy++, it has no children, so no native objects.
    The reason for this design decision is probably that there was no other way to assure identical functionality across all platforms.

    Therefore this is a Qt default which in my opinion is badly chosen, since the Windows default is just the opposite - to always underline button shortcuts in dialogs.

    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #22

      my windows 7 do not have underscore as default.
      only when i press alt.
      That goes for buttons and menus.
      Except some common file open dialog it seems :)

      1 Reply Last reply
      0
      • H Harry123

        @kshegunov

        I don't think this is a system default, since Qt paints its buttons itself and does not use native widgets.
        I say this because if I look into a Qt dialog using Spy++, it has no children, so no native objects.
        The reason for this design decision is probably that there was no other way to assure identical functionality across all platforms.

        Therefore this is a Qt default which in my opinion is badly chosen, since the Windows default is just the opposite - to always underline button shortcuts in dialogs.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #23

        @Harry123

        I don't think this is a system default, since Qt paints its buttons itself and does not use native widgets.

        Which wouldn't stop it to honor the default system behavior, would it?

        As @mrjj noted:

        my windows 7 do not have underscore as default.

        Which had been my experience as well.

        The reason for this design decision is probably that there was no other way to assure identical functionality across all platforms.

        This design decision, if memory serves me, happened some time when Qt 4 was developed (which should be about 10 years ago) and it was mostly done because using native handles is costly as hell, and UIs tend to just eat up resources if you have a handle for each tiny thing. And it's been working just fine, if I may add.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • H Harry123

          I'm under Windows, and I add several QPushButtons to a QMessageBox. A shortcut key is specified by an ampersand before the preferred character in each text.

          When the message box is initially displayed, the shortcut keys of all buttons are not marked by an underline, but :

          1. The button does execute if I type the shortcut key in spite of the missing underline.
          2. If I press the Alt key, the shortcut underline appears on all buttons and stays displayed after I release the Alt key.

          This lack of an initial visual cue may cause the end-user to assume that shortcuts were not provided.

          Is there something I should do to force the display of the shortcut underlines when the message box is initially displayed ?

          J Offline
          J Offline
          jortegaruiz
          wrote on last edited by
          #24

          @Harry123
          I did it putting this in main.cpp and that's all folks ;-)

          QApplication a(argc, argv);
          a.setStyle("fusion");
          
          1 Reply Last reply
          1

          • Login

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