QString with diacritical characters
I have made a keyboard with all characters I need, also
with diacritical characters.
A Signalmapper mapped with the hex-Code of the character, gives me the
But if I press one of the diacritical characters, the program
doesn't accept it.
ushort from Signalmapper is 0x010C (C with caron).
I append it to the string tmpString.append(QString::fromUtf16(0x010C,1));
But this doesn't work, can anybody help me with my problem.
I really don't know how I get the diacritical symbols working.
I think your use of fromUtf16 is wrong. It expects a c type string in the right encoding, but you're giving it a UTF code point and a length 1. Perhaps you're looking for [[doc:QChar]]? You can create those using the code point, and you can append them to a QString.
now I tried it with QChar and it doesn't work.
@Signalmapper -> 0x0152 -> QChar test(0x0152)
Edit: added @ tags around code section; Andre
The, something else is off. This code works for me:
MainWindow::MainWindow(QWidget *parent) :
QChar test(0x0152); //this code might as well come from somewhere else...
And please, use @ tags around code sections. They become much easier to read.
Is there a global settings for the encoding of a label?
I wrote the code like above, but it doesn't work.
could this be a problem of the embedded linux?
Well, I got this as the label: Œ
That is the correct code point according to the character map application. Using 0x010C results in Č as the contents of my label. Looks good to me.
Are you sure your font actually contains these code points?
i am using the Liberation font and this pdf "Liberation":http://www.ascendercorp.de/pdf/Liberationsans.pdf shows the included charaters.
i tried it with Æ and this works.
I have found the problem.
qt uses the fonts in /usr/lib/fonts/ instead of /usr/share/fonts/
and if the label is set to Liberation, qt uses a other font
in its folder.