change font while writting, QGraphicsTextItem
hello everyone ;)
I have some textitems (a derived class) and want to change the QFont, I can do it for the whole item or just for a selected part. But I couldn't figure out how i can change the font of the text, i'm going to write without changing the whole textitem's font...
i'm writting and now i want to change the font without changing the font of the written part
thank you for your help ;)
airglide
Re: change font while writting, QGraphicsTextItem
The text item contains a QTextDocument. You can use its API to manipulate the content the way you want.
Re: change font while writting, QGraphicsTextItem
sorry for my late reply.. ;)
Yes I've seen it but there's only the function setFont() and this sets the font of the whole widget. I've written also that you can highlight text and than change Font with textCursor() and mergeCharFormat() but how can I say from now on I want to write in Arial ... can I insert html tags or something like this? or do I have to set every new written Character a Font?
Re: change font while writting, QGraphicsTextItem
Quote:
Originally Posted by
airglide
Yes I've seen it but there's only the function setFont()
No, there is a whole API for manipulating each character of the text separately. Read the docs on QTextDocument, it's all there.
Quote:
but how can I say from now on I want to write in Arial
QTextCursor::setCharFormat()
Re: change font while writting, QGraphicsTextItem
great, it works fine now, thank you