Results 1 to 3 of 3

Thread: How to change paragraph number in QTextEdit?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Hyderabad
    Posts
    69
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default How to change paragraph number in QTextEdit?

    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:
    Qt Code:
    1. if( e->type() == QEvent::MouseButtonDblClick )
    2. {
    3. QPoint clickPos = m->pos()+QPoint( (te->geometry().topLeft()) - te->frameGeometry().topLeft()));
    4.  
    5. int para1= te->paragraphAt(clickPos);
    6. QString line=te->text(para1);
    7.  
    8. return true;
    9. }
    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.
    Last edited by Sarma; 10th March 2006 at 09:32.

Similar Threads

  1. how can I find number of lines in QTextedit ?
    By newplayer in forum Newbie
    Replies: 10
    Last Post: 14th August 2008, 23:02
  2. Change margin on QTextEdit print()
    By Dii in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2008, 22:45
  3. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. Replies: 2
    Last Post: 9th March 2007, 23:19

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.