I've got a problem with interactive text formatting inside a QGraphicsTextItem (more correctly inside my own QGraphicsTextItem-derived class).
I have created the same toolbar as in diagramscene example with five controls - two combos and three buttons - and implemented my own text formatting methods using QTextCursor to apply new formatting to selected text fragments only.
The problem is that when I click on the toolbar on font or font size combo the item on the scene looses focus (and thus looses text selection) and formatting doesn't applies to the text. At the same time simple buttons (bold, italic etc) work OK. It seems that I've missed some option that prevents item from loosing its focus when the mouse pointer leaves the scene or something like this.
Can anybody help me to solve this? Thanks in advance.
PS. I've looked at textedit demo and found that it connects combos' activated() signals to custom slots. It this a solution to this problem? Is there a more advanced example (than the buggy diagramscene) on how to interactively format text inside QGraphicsTextItem?
Bookmarks