Durkin
12th May 2013, 22:08
Hello,
I have some QGraphicsItems onto which text is drawn from a QString, as well as some buttons whose title again is set from a QString. I 'd like that to include superscripts. Hard-coding it like this
QString text("σ²");
works, but I 'd like to superscript an arbitrary number. Ie say there was such a function Qsup then ideally I 'd do something like this:
QString text("σ" + Qsup(x));
What would be the best approach? Is it possible to use one of qt formats that employ html tags and convert that to a QString? If so a short example would be appreciated.
As an aside, it 'd be ideal to load the text data from a file. But I have trouble loading superscript characters from a plain *.txt file (which is what I 'm using now), no matter what encoding I choose. Any hints about that would also be great.
Thanks.
I have some QGraphicsItems onto which text is drawn from a QString, as well as some buttons whose title again is set from a QString. I 'd like that to include superscripts. Hard-coding it like this
QString text("σ²");
works, but I 'd like to superscript an arbitrary number. Ie say there was such a function Qsup then ideally I 'd do something like this:
QString text("σ" + Qsup(x));
What would be the best approach? Is it possible to use one of qt formats that employ html tags and convert that to a QString? If so a short example would be appreciated.
As an aside, it 'd be ideal to load the text data from a file. But I have trouble loading superscript characters from a plain *.txt file (which is what I 'm using now), no matter what encoding I choose. Any hints about that would also be great.
Thanks.