Hi,
I have posted a thread previously on MouseButtonDblClick event. I have asked how to get the text at the position where the mouse is doubleclicked. I have written the code as:
if( e
->type
() == QEvent::MouseButtonDblClick ) {
QPoint clickPos
= m
->pos
()+QPoint( (te
->geometry
().
topLeft()) - te
->frameGeometry
().
topLeft()));
int para1= te->paragraphAt(clickPos);
return true;
}
if( e->type() == QEvent::MouseButtonDblClick )
{
QMouseEvent *m = (QMouseEvent*) e;
QPoint clickPos = m->pos()+QPoint( (te->geometry().topLeft()) - te->frameGeometry().topLeft()));
int para1= te->paragraphAt(clickPos);
QString line=te->text(para1);
return true;
}
To copy to clipboard, switch view to plain text mode
But now the problem is, when the scrollbar is dragged for a large file, and when mouse is clicked on a line, it is taking the para1 as the line number in the current visible area. That means, if the capacity of the visible region of the textedit is 10 lines, at any time(even when scrollbar is dragged to middle of a large file) the variable para1 is holding the values from 1-10 because of which, the variable "line" is taking only those lines.
So, please take time to understand my problem ( as I might not put it in correct way ) and give me a good solution
Thanks a lot,
Sarma.
Bookmarks