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

M. Bashir Al-Noimi mbnoimi at gmx.com
Sun Mar 7 18:54:11 CET 2010


Hi All,


On 07/03/2010 06:47 م, Frank Mertens wrote:
> M. Bashir Al-Noimi wrote:
>    
>> 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);
>>
>>      
> I checked it, it is valid UTF8. Interesting to see some Arab text rendered by Qt.
>    
Thanks ;-)

> How is that going for you? Qt seems to even get the cursor movement done right,
> although shouldn't the cursor keys be swapped?...
>    
Actually Qt has some problems in RightToLeft languages specially Arabic 
lang. (where GTK is more friendly) so every time I get a bug I report it 
immediately.

> I'm used to switch off font merging to see if the font actually contains
> specific glyphs (see QFont::StyleStrategy).
Nice.

> And note that with Qt/Cocoa Qt will
> switch from ATSUI to CoreText, if you are using a Mac.
>    
Sorry, I'm using kubuntu and windows xp

-- 
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net




More information about the Qt-interest-old mailing list