1

Topic: Titles of buttons (Qt:: Key)

We have certain buttons from  Qt:: Key. I try to receive their titles the text. All is good, except , an alto,  and buttons "meta" ("bun" on the Poppy, "windows" on Windows, accordingly). I do so: std:: cout <<QKeySequence (Qt:: Key_ScrollLock).toString ().toUtf8 ().constData () <<std:: endl; the Output, it is expected, "ScrollLock" we Take an alto: std:: cout <<QKeySequence (Qt:: Key_Alt).toString ().toUtf8 ().constData () <<std:: endl; And here  it turns out: "?" How to win? Such ambush only with , an alto,  and "meta"? To process these cases separately? Whether it appears so, what there are still similar surprises?

2

Re: Titles of buttons (Qt:: Key)

Hello, XOOIOOX, you wrote: XOO> How to win? Such ambush only with , an alto,  and "meta"? To process these cases separately? Whether it appears so, what there are still similar surprises? Laziness to understand, look qtbase/src/gui/kernel/qkeysequence.cpp int QKeySequencePrivate:: decodeString (QString accel, QKeySequence:: SequenceFormat format) there with these buttons what at that . And if to you on fast make so std:: cout <<QKeySequence (Qt:: AltModifier).toString ().toUtf8 ().constData () <<std:: endl;

3

Re: Titles of buttons (Qt:: Key)

Hello, Dead Down, you wrote: >qtbase/src/gui/kernel/qkeysequence.cpp > int QKeySequencePrivate:: decodeString (QString accel, QKeySequence:: SequenceFormat format) There inside all is not so pleasant. Hoped that there is any more other alternative, but, probably, no. > there with these buttons what that . It is clarified that not only with them. Here these too give delirium on an output: Key_Super_L, Key_Hyper_L and still it is not known, how many such. It is necessary to shovel pens all special cases. > And if to you on fast make so > std:: cout <<QKeySequence (Qt:: AltModifier).toString ().toUtf8 ().constData () <<std:: endl; Well, this such to itself. A bench hammer. To too, produces "Alt +", and it is necessary "Alt"  without "+".  a method "all in the text": class KeyHelper: private QObject {public: static QString keyName (int index) {static int keyEnumIndex = staticQtMetaObject.indexOfEnumerator ("Key"); QString name = staticQtMetaObject.enumerator (keyEnumIndex).valueToKey (index); if (index> = Qt:: Key_Left && index <= Qt:: Key_Down) name + = "Arrow"; return name.isEmpty ()? QString (): name.mid (4);}}; But it produces instead of  characters of type of tags of a copyright, degrees and other the plain text. .