Results 1 to 10 of 10

Thread: multiple cursor selection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: multiple cursor selection

    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Dec 2014
    Posts
    29
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: multiple cursor selection

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: multiple cursor selection

    That would probably mean your find() call is incorrect. Maybe you should use QTextDocument::find() instead?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Dec 2014
    Posts
    29
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: multiple cursor selection

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: multiple cursor selection

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Dec 2014
    Posts
    29
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: multiple cursor selection

    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

    the logic of your program should update all cursors at the same time while you are performing the edit.
    that's what I wish to achieve, but I don't know how.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: multiple cursor selection

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 5th August 2014, 12:37
  2. Multiple selection ??
    By marc2050 in forum Newbie
    Replies: 1
    Last Post: 9th May 2011, 02:10
  3. QGraphicsScene and multiple selection
    By Bill in forum Newbie
    Replies: 1
    Last Post: 4th August 2009, 15:19
  4. QTableWidget Sorting Multiple Selection
    By rhiacasta in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2006, 21:05
  5. Multiple selection in QTextEdit
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2006, 07:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.