PDA

View Full Version : Column Selection Text Editor



zyxue
20th June 2007, 08:48
I'm no writing a text editor based on the QTextEdit class. I'd like to add the column selection support in the text editor but don't know how to add this to QTextEdit. Can any one give me some hints?

Thank you for any input.
Best regards
Zhiyong Xue

fullmetalcoder
20th June 2007, 09:28
You'll have to do a lot by hand... First there will be several event handlers to reimplement (mousePress, mouseMove, mouseRelease) then you'll have to figure out a bright way of handling complex selections (impossible to do out-of-box with QTextCursor...) so that the QTextEdit knows that some text is selected and then reimp createMimeDataFromSelection() to allow D'n'D, copy/paste. Still there will probably remain many broken stuff unless you reimplement QTextEdit from scratch (from QAbstractScrollArea actually ;)) or, at the very least, all event handlers. It may sound pretty hard (and it actually is kinda...) but it remains doable.