QPushButton in QMessageBox missing key shortcut underline on initial display
-
@Harry123
Your claim seemed somewhat dubious, so even if I don't actively develop on windows I've loaded the gui module and searched through it with the dependency walker. The symbol is there (Qt 5.5.1 installed with Qt maintenance tool), see the screenshot, and it is exported.
I don't know what error exactly you're getting but you should be able to use the function if declared properly (as mentioned in the documentation I sourced in my previous post). -
Sorry, my claim was more than dubious - unfortunately I put the call in a section of extern "C".
Stupid mistake, but this is a complicated body of code.Results: calling qt_set_sequence_auto_mnemonic with the parameters of either true or false did not restore the underlines.
-
Results: calling qt_set_sequence_auto_mnemonic with the parameters of either true or false did not restore the underlines.
That's unfortunate. Another thing you could try is to set a global proxy style for your application and manually force the
QStyle::SH_UnderlineShortcut
flag.Kind regards.
-
This works. I modified the example in the link with :
if (hint == QStyle::SH_UnderlineShortcut) return 1;
I now have underlines. Much better than faking an Alt key and it works for all future dialogs.
Very many thanks.
-
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.
-
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 :) -
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.