[Qt-interest] QDialogButtonBox question
Robert Hairgrove
evorgriahr at hispeed.ch
Sat May 8 17:52:22 CEST 2010
Robert Hairgrove wrote:
> Just a thought ... why are there pre-defined shortcut accelerator keys
> defined for "OK" and "Cancel", but none for "Help"?
>
> Also, are these captions translatable? I don't see any way of editing
> them... (I know how to fix this in my code, but why isn't it built in?)
Thanks for the suggestions re: translations. The documentation refers to
a template file I can use to translate Qt into other languages (Scott,
is this what you meant by "untranslated"?) It looks like 4.6.2 doesn't
include this file anymore. But I can just copy one of the other language
.ts files and rename it to something else, I suppose.
As to why some buttons have shortcut keys assigned and others not, I
found this section of source code for QDialogButtonBox:
switch (sbutton) {
case QDialogButtonBox::Ok:
buttonText = gnomeLayout ?
QT_TRANSLATE_NOOP("QDialogButtonBox", "&OK") :
QT_TRANSLATE_NOOP("QDialogButtonBox", "OK");
break;
case QDialogButtonBox::Save:
buttonText = gnomeLayout ?
QT_TRANSLATE_NOOP("QDialogButtonBox", "&Save") :
QT_TRANSLATE_NOOP("QDialogButtonBox", "Save");
break;
case QDialogButtonBox::Open:
buttonText = QT_TRANSLATE_NOOP("QDialogButtonBox", "Open");
break;
etc.
It seems that shortcuts are only given for buttons if "gnomeLayout" is
true. Since I am working on Ubuntu, which uses the Gnome window manager,
this is the case. But as you can see, some buttons such as "Open" and
"Help" are not given accelerators.
Handy as QDialogButtonBox is, I think I will revert to using regular
buttons in order to ensure that I have complete control over the text.
More information about the Qt-interest-old
mailing list