Results 1 to 2 of 2

Thread: How to get QTextCursor under QCursor in QTextEdit?

  1. #1
    Join Date
    Feb 2008
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How to get QTextCursor under QCursor in QTextEdit?

    Hi, everyone! I have some problem with QTextEdit. How I can get QTextCursor under QCursor (mouse cursor)? (When I receive mouse move event, I need get text format under mouse cursor. It is possible, if I'll get QTextCursor under QCursor. But QCursor has its own coordinates and QTextCursor has its own coordinates.) It's really important for me! Thanks a lot!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get QTextCursor under QCursor in QTextEdit?

    Use QText::cursorForPosition(). Just remember the point has to be in viewport coordinates.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  3. QTextEdit and cursor
    By newplayer in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2008, 23:24
  4. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  5. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

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.