Results 1 to 10 of 10

Thread: qtextcursor setposition doesn't work

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default qtextcursor setposition doesn't work

    Hello,

    in a program I have the following code:
    Qt Code:
    1. void FindWidget::slotClose() {
    2. cursor = mTextpage->textCursor();
    3. qDebug() << "cursor position on close start: " << cursor.position();
    4. if ( cursor.position() == -1) {
    5. cursor.setPosition(QTextCursor::Start,QTextCursor::MoveAnchor);
    6. qDebug() << "cursor position after setPosition: " << cursor.position();
    7.  
    8. mTextpage->setTextCursor(cursor);
    9. }
    10. mTextpage->setFocus();
    11. close();
    12. }
    To copy to clipboard, switch view to plain text mode 

    Example output is the following
    Qt Code:
    1. cursor position on close start: -1
    2. cursor position after setPosition: -1
    To copy to clipboard, switch view to plain text mode 
    Anyone got an idea, what's goind wrong here? I also tried, not to use cursor as member and used the following instead:
    Qt Code:
    1. QTextCursor cursor = mTextpage->textCursor();
    To copy to clipboard, switch view to plain text mode 
    Also, same result.

    Thanks in advance for any help.
    Last edited by doc_symbiosis; 5th October 2012 at 16:15.

Similar Threads

  1. Example in Qt labs doesn't work
    By matko in forum Newbie
    Replies: 1
    Last Post: 19th November 2009, 18:59
  2. macdeployqt doesn't work at all.
    By pherthyl in forum Installation and Deployment
    Replies: 1
    Last Post: 10th July 2009, 00:42
  3. Shortcut doesn't work
    By stella1016 in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2009, 02:37
  4. QRegExp doesn't seem to work as it should
    By thomaspu in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2007, 07:49
  5. setTabStopWidth doesn't work
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 19th November 2007, 08:29

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.