[Qt-interest] View UTF-8 text by QGraphicsTextItem

Thiago Macieira thiago at kde.org
Sun Mar 7 16:16:38 CET 2010


Em Domingo 7. Março 2010, às 15.26.09, M. Bashir Al-Noimi escreveu:
> Hi All,
> 
> When I tried to add QGraphicsTextItem item in QGraphicsScene object I
> got illegal characters (as shown in the following pix) although I used
> QString::fromUtf8 function !!!
> 
> *How I can view utf8 text in QGraphicsView?*
> 
> 
> snippet---
> 
>      graphic_itemText =new  QGraphicsTextItem(QString::fromUtf8("نص
> عربي")); 
> scene->addItem(graphic_itemText);
>      graphic_itemText->setFont(QFont("Tahoma", 15));
>      graphic_itemText->setPos(sceneWidth-pix_factory.width()-100, 15);

Are you sure your source-code is UTF-8 encoded?
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100307/563227c4/attachment.bin 


More information about the Qt-interest-old mailing list