Results 1 to 7 of 7

Thread: Moveto perticular leine in QTextDocument

  1. #1
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Post Moveto perticular leine in QTextDocument

    How can i move to perticular line or get the x and y position of a perticular line of QTextDocument.

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by bismitapadhy View Post
    How can i move to perticular line
    You can use :
    Qt Code:
    1. QTextDocument::findBlockByLineNumber(int lineNumber)
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by bismitapadhy View Post
    get the x and y position of a perticular line of QTextDocument.
    Try:
    Qt Code:
    1. QTextDocument::findBlockByLineNumber(int lineNumber).layout()->position();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by yogeshgokul View Post
    You can use :
    Qt Code:
    1. QTextDocument::findBlockByLineNumber(int lineNumber)
    To copy to clipboard, switch view to plain text mode 


    Try:
    Qt Code:
    1. QTextDocument::findBlockByLineNumber(int lineNumber).layout()->position();
    To copy to clipboard, switch view to plain text mode 
    In Qt 4.3.0 there is no function like FindBlockByLineNumber(int LineNo)
    Please give me any other solution to findout.

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by bismitapadhy View Post
    In Qt 4.3.0 there is no function like FindBlockByLineNumber(int LineNo)
    Please give me any other solution to findout.
    Yes this function was introduced in Qt 4.5.
    You can use
    Qt Code:
    1. QTextDocument::findBlock()
    To copy to clipboard, switch view to plain text mode 
    But this will only works for character position, not with line number.

  5. #5
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by yogeshgokul View Post
    Yes this function was introduced in Qt 4.5.
    You can use
    Qt Code:
    1. QTextDocument::findBlock()
    To copy to clipboard, switch view to plain text mode 
    But this will only works for character position, not with line number.
    I saw findBlock().But i cant use it. I want the position of a perticular. I have input is only Line Number.Do Uou hava any solution for this.

  6. #6
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by bismitapadhy View Post
    I have input is only Line Number.Do Uou hava any solution for this.
    Update your Qt to 4.5.

  7. #7
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Moveto perticular leine in QTextDocument

    Quote Originally Posted by yogeshgokul View Post
    Update your Qt to 4.5.
    We have only Qt 4.3 license. So if you have any solution using Qt 4.3 please tell.

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.