How to find the index of a string in block when I have the index of the string in the WHOLE text
Solved
General and Desktop
-
wrote on 15 Aug 2019, 18:31 last edited by
So I have a QPlainTextEdit which is filled with text and I have the index of a string and that index represents its position in the whole QPlainTextEdit text area
But how do I get that index position in the block where that piece of text resides?
-
wrote on 15 Aug 2019, 18:47 last edited by
Subtract that start of the index of the block from the index of the string. That should convert the coordinates to block coordinates vs whole string coordinates. Then make sure that the new index does not exceed the length of the block.
1/2