Results 1 to 3 of 3

Thread: Disable QTextCursor Mouse click repositioning

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Disable QTextCursor Mouse click repositioning

    Quote Originally Posted by VireX View Post
    I tried doing this to keep the cursor at the end of all the TEXT. However, this did not work:
    Qt Code:
    1. qtxtbrowser->textCursor().clearSelection();
    2. qtxtbrowser->textCursor().movePosition(QTextCursor::End);
    3. qtxtbrowser->insertHtml(qsData+"<br>");
    To copy to clipboard, switch view to plain text mode 
    That is modifying a copy. It should be done in this way:
    Qt Code:
    1. QTextCursor cursor = qtxtbrowser->textCursor();
    2. cursor.clearSelection();
    3. cursor.movePosition(QTextCursor::End);
    4. qtextbrowser->setTextCursor(cursor); // <--
    5. qtxtbrowser->insertHtml(qsData+"<br>");
    To copy to clipboard, switch view to plain text mode 
    By the way, Qt 4.2 introduces a new convenience method for moving the cursor. You could try something like this:
    Qt Code:
    1. qtxtbrowser->moveCursor(QTextCursor::End);
    2. qtxtbrowser->insertHtml(qsData+"<br>");
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    VireX (3rd April 2007)

  3. #2
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Disable QTextCursor Mouse click repositioning

    You're amazing thank you so much . Especially on the fast reply <3.

Similar Threads

  1. Replies: 1
    Last Post: 9th February 2007, 09:41
  2. QGraphicsScene Click / Double Click
    By philentropist in forum Qt Programming
    Replies: 1
    Last Post: 9th February 2007, 04:32
  3. Replies: 4
    Last Post: 31st August 2006, 12:11

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.