Updating a QGraphicsTextItem
I've been working with QGraphicsTextItems. I currently have the laid out in a scene, each depicting a physical page of text. Right now I'm overriding the keyReleaseEvent function to redistribute the text typed across all of the pages. The problem with this is that when I set the text with setPlainText, the cursor moves back to the beginning of the textitem that is set as the focus item for the scene.
As you can imagine, this is problematic when typing, especially on another page instead of the one set to focus, it also makes the keyboard shortcuts for cutting and copying not work at all.
Is there a way to set the text of a QGraphicsTextItem without it resetting the cursor / moving the cursor?
Is there any extra data I could give to help me get an answer? I really am stuck.
Guest last edited by
If you use setPlainText(), the whole QTextItem will get cleared and all previous undo/redo info is lost, so the cursor moves to 0 position. If you use movePostion or setPosition, the cursor doesn't seem to move.
So why not use insertText() and then use your logic to repaginate. I tried a quick example and this works.