Results 1 to 9 of 9

Thread: Segmentation Fault When Moving QTextCursor Anchor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation Fault When Moving QTextCursor Anchor

    Your idea is fine but which connect to cursorPositionChanged then? I mean - how should a user change the cursor at all then?

  2. #2
    Join Date
    Jun 2021
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Segmentation Fault When Moving QTextCursor Anchor

    The user moves the cursor by clicking. In any case, I fixed the issue by changing handleSelect to this:

    Qt Code:
    1. void MainWindow::handleSelect(){
    2. if (ListWindow->textCursor().atBlockEnd() == false){
    3. ListWindow->moveCursor(QTextCursor::StartOfLine);
    4. ListWindow->moveCursor(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
    5. }
    6. }
    To copy to clipboard, switch view to plain text mode 

    Works fine for test cases, should be fine moving forward. Thanks for the help.

Similar Threads

  1. problem while moving QTextCursor
    By Abdeljalil in forum Qt Programming
    Replies: 2
    Last Post: 1st November 2014, 11:45
  2. QPlainTextEdit selecting Text without moving anchor
    By janeljanson in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2012, 12:47
  3. a segmentation fault
    By yaohao@qtcentre in forum Qt Programming
    Replies: 4
    Last Post: 17th March 2011, 09:01
  4. Segmentation Fault
    By jmc in forum Qt Tools
    Replies: 4
    Last Post: 24th February 2010, 20:08
  5. segmentation fault
    By shamik in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2006, 07:33

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.