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

Scott Aron Bloom scott at onshorecs.com
Sun Mar 7 22:32:01 CET 2010


You may want to look at setCodecForCStrings

http://doc.trolltech.com/4.6/qtextcodec.html#setCodecForCStrings


Scott
On Mar 7, 2010, at 9:45 AM, M. Bashir Al-Noimi wrote:

> Hi All,
>
> Oh my god, Qt Creator takes system encoding by default, so encoding  
> of the source file isn't UTF-8 (I was using kubuntu but now I'm  
> using damn Windows).
>
> Thanks Thiago for remembering me, it's working now.
>
>
>
> On 07/03/2010 05:16 م, Thiago Macieira wrote:
>>
>> 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?
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
> -- 
> Best Regards
> Muhammad Bashir Al-Noimi
> My Blog: http://mbnoimi.net
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100307/fcd86b59/attachment.html 


More information about the Qt-interest-old mailing list