QString with diacritical characters
-
Hello,
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
pressed key.
But if I press one of the diacritical characters, the program
doesn't accept it.For example:
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.
-
The, something else is off. This code works for me:
@MainWindow::MainWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
QChar test(0x0152); //this code might as well come from somewhere else...
QString testString;
testString.append(test);
ui->label->setText(testString);
}@
And please, use @ tags around code sections. They become much easier to read.
-
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.