What is the effect you are getting? How many items does extraSelections have before line #22? Is the cursor for each of the selections set properly?
What is the effect you are getting? How many items does extraSelections have before line #22? Is the cursor for each of the selections set properly?
You can see on second picture what effect I'm getting, if I'm reading this right for(test example) I have
[<PyQt5.QtWidgets.ExtraSelection object at 0x7f25924b1dd8>, <PyQt5.QtWidgets.ExtraSelection object at 0x7f25924b1c88>, <PyQt5.QtWidgets.ExtraSelection object at 0x7f25924b1eb8>]
3 items in extraSelections
Last edited by vuletic; 19th March 2015 at 23:45.
That would probably mean your find() call is incorrect. Maybe you should use QTextDocument::find() instead?
No matter what I try every word is painted correctly, but only last word found is selected.
Last edited by vuletic; 20th March 2015 at 00:50.
That's because "extra selections" are not real selections. The logic of your program should update all cursors at the same time while you are performing the edit.
Since english is not my native language, maybe I didn't explain it right, but if you look at these two videos:
this is what I want:
https://www.youtube.com/watch?v=Ux3_...ature=youtu.be
and this is what I have at this moment:
https://www.youtube.com/watch?v=NouO...ature=youtu.be
that's what I wish to achieve, but I don't know how.the logic of your program should update all cursors at the same time while you are performing the edit.
QTextCursor API can be used to edit the document. So if you want to enter "foo" in 10 places, you need to have cursors set to each of the place and use its API to insert "foo" through each cursor.
Bookmarks