Hi everyone.
Let’s see on the next example of QPlaintTextEdit containing
text_text
text_text place_1/place_2/place_3 text_text
text
I need to get string “place_1/place_2/place_3” and set it to some QString variable by placing cursor on this very string (by clicking on this part of text or by changing cursor position by arrows). A tried several ways to do it but they didn’t help. I can use TextCursor::WordUnderCursor selection but symbol ‘/’ is a split symbol what means I can’t select this entire string with this option. Another option is to get an entire line from text browser and somehow determine position of considering part in this somehow. The other option is to use QTextBlockFormat but I can’t understand what is a block of text by default (lines, some number of chars, etc) and how I can change the policy of splitting text on blocks.
I think this problem is quite common and there should be an easy way to solve it. Can anyone help?
↧