QShortcut is language dependent!
I am using Ubuntu 13.04 and I am developing a program with this OS as target. At this Ubuntu release, the shortcuts I use for inside the program tend to be language dependent. If I recall correctly, this wasn't an issue at previous Ubuntu releases.
For example, if I have this shortcut:
@(void) new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(quit_program()));@
it won't work, unless the keyboard language is set to English.
How can I make the shortcuts language independent?
That's strange, are you sure it's not a modification in ubuntu that might cause that ?
Try using tr like in QShortCut's documentation do see if it improves
Nope! That still fails miserably when I switch the language of my keyboard.
Please notice that all these things fail:
- The original way I tried
- The way with tr()
- The way from the UI editor:
BUT all three work fine when the language is set to English.
Tested in my machine and a friend's of mine, both running the latest Ubuntu 13.04 stable release.
I don't know who is to blame, but now that I think of it, this is my first test with Qt5 and QShortcut!
Unfortunately, I immediately started using Qt5 when I switched to 13.04. So, I've no idea.
Ok then, does it work with Qt 4 ?
Just made an Ubuntu 13.04 live USB, installed all the liqt4-* libs, compiled a previous version of my program compatible with the qt4 libs and the shortcuts work just fine using both keyboard layouts.
Also, under Ubuntu 13.04, using programs that aren't build with Qt5 libs (like programs written in C, or in Python etc) I can use the shortcuts no matter the keyboard's language.
Then this might be a bug.
You can check the "bugreport":bugreports.qt-project.org/issues/ system to see if there's already something about it. Otherwise you can create a new report. Maybe first ask on the mailing list
I can confirm this bug only on letter Q
my guess? when switched on greek, pressing Q represents ";" which is not a letter and qt gets confused.