Important: Please read the Qt Code of Conduct -

Implementing multi-selection in QTextEdit

  • Hi all,

    I'm developing a QTextEdit-based editor, and I need to implement "block mode". In that mode, rectangular blocks must be selected, instead of standard continuous selection. The pic below illustrates what I mean.

    ! pic)!

    To be honest, I've already implemented that mode using the QTextEdit::ExtraSelection class and setExtraSelections() function, but the code looks not very well and there are still some issues.

    So, any ideas? All I've googled is a suggestion to use Q3TextEdit which somehow supports multi-selection, but, of course, that is not what I need. I can post my code if necessary.

  • No ideas?

    It would be also fine to implement some mode in which it's possible to position the cursor at any point of the edit. I mean something like Borland Delphi's source code editor.

Log in to reply