PDA

View Full Version : Moveto perticular leine in QTextDocument



bismitapadhy
10th August 2009, 08:14
How can i move to perticular line or get the x and y position of a perticular line of QTextDocument.

yogeshgokul
10th August 2009, 08:26
How can i move to perticular line
You can use :
QTextDocument::findBlockByLineNumber(int lineNumber)


get the x and y position of a perticular line of QTextDocument.
Try:
QTextDocument::findBlockByLineNumber(int lineNumber).layout()->position();

bismitapadhy
10th August 2009, 08:32
You can use :
QTextDocument::findBlockByLineNumber(int lineNumber)


Try:
QTextDocument::findBlockByLineNumber(int lineNumber).layout()->position();
In Qt 4.3.0 there is no function like FindBlockByLineNumber(int LineNo)
Please give me any other solution to findout.

yogeshgokul
10th August 2009, 08:35
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
QTextDocument::findBlock()
But this will only works for character position, not with line number.

bismitapadhy
10th August 2009, 08:38
Yes this function was introduced in Qt 4.5.
You can use
QTextDocument::findBlock()
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.

yogeshgokul
10th August 2009, 09:06
I have input is only Line Number.Do Uou hava any solution for this.
Update your Qt to 4.5. ;);)

bismitapadhy
10th August 2009, 09:12
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.