[Qt-interest] How to add a superscript text for any QAction item in QMenu
Thiago Macieira
thiago.macieira at trolltech.com
Tue Apr 7 13:54:08 CEST 2009
Em Terça-feira 07 Abril 2009, às 11:02:22, você escreveu:
> Hi Thiago Macieira,
>
> How did you generate the no's 342\204\242
>
> I would like to know, since I would want for the string "PRO".
>
> Kindly let me know how to generate those no's for this!
>
In this case, I was lazy and I opened KCharSelect (KDE4). I searched for 2122
and it showed this information:
Character: ™ U+2122
Name: TRADE MARK SIGN
Annotations and Cross References
Approximate equivalents:
* <super> T U+0054 LATIN CAPITAL LETTER T M U+004D LATIN CAPITAL LETTER M
General Character Properties
Block: Letterlike Symbols
Unicode category: Symbol, Other
Various Useful Representations
UTF-8: 0xE2 0x84 0xA2
UTF-16: 0x2122
C octal escaped UTF-8: \342\204\242
XML decimal entity: ™
The UTF-8 representation is what we're interested in. The difference is one is
encoded in hex and the other is encoded in octal (that is, 0xE2 = 0342).
There must be many other tools that show the UTF-8 representation in octal
given the Unicode codepoint. The UTF-8 encoding itself is specified in RFC
3629. See http://en.wikipedia.org/wiki/UTF-8 for a table on how the encoding
is done.
Another way of doing this is to use an UTF-8 shell and type:
$ echo ™ | od -tc
0000000 342 204 242 \n
If your shell is not UTF-8 capable, you can still type any valid character in
your encoding and convert to UTF-8:
$ echo ™ | iconv -t utf-8 | od -tc
0000000 342 204 242 \n
> Thiago Macieira wrote:
> > Em Terça-feira 07 Abril 2009, às 07:58:06, Girish Ramakrishnan escreveu:
> >> action->setText(QString("Foo%1").arg(QChar(0x2122)));
> >
> > Also:
> > QString::fromUtf8("Foo\342\204\242");
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/3a33528a/attachment.bin
More information about the Qt-interest-old
mailing list