PDA

View Full Version : What are the basic ideas behind implementing your own text editing widget?



houzi
6th May 2014, 04:16
I have managed to play around with QTextLayout to get a feel for working with Qt.
I would like to add my own text editing to the QTextLayout, since I want some highly customized behavior.

What is the basic idea for adding text editing to QTextLayout?
Do I define signals/slots for every key that could send a character and insert this character to the QTextLayout with the setText() method and update the cursor position accordingly?

Do I also have to implement a piece-table data structure to handle the text editing back-end?

Basically: do I get anything for free when I'm not using QTextEdit, or can I use something for handling the keyboard input and text buffer, i.e an implementation of the piece-table data structure or something similar.