Results 1 to 2 of 2

Thread: Is there a way to get text from under the mouse cursor?

  1. #1
    Join Date
    Jul 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Is there a way to get text from under the mouse cursor?

    I want to make a pop-up tool that gets the character from under the mouse cursor and a number of consequent characters. I want to use them to display the translation of this word/phrase using a dictionary. Hopefully I want to be able to parse everything in a Qt application, but if it's not possible, parsing text in WebKit would be enough.

    I googled and asked on IRC, and the only thing i've got is that someone recommends using the accessibility interface, but i just don't know which part of it I can apply. The other ways include marking each character in the WebKint and using Javascript to invoke events.

    So, is there a clean and tidy method of retrieving text from under the mouse cursor? Thanks in advance.

  2. #2
    Join Date
    Nov 2007
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Is there a way to get text from under the mouse cursor?

    If using a QTextEdit, QTextEdit::cursorForPosition() should help. Pass it the mouse position and then use a QTextCursor to select and get the word.

    -Josh

Similar Threads

  1. QGraphicsTextItem and text cursor position via QPoint
    By Lykurg in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2017, 18:38
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  3. Replies: 1
    Last Post: 16th July 2009, 16:58
  4. Replies: 1
    Last Post: 10th July 2009, 09:54
  5. Trouble with cursor and selecting text in QTextEdit
    By R_Torsten in forum Qt Programming
    Replies: 3
    Last Post: 7th June 2008, 19:17

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.