QPlainTextEdit: get text under mouse cursor



  • Hello,

    How can i get the word under my mouse cursor in a QPlainTextEdit?

    I already tried to search the source code, but the code seems to be in QPlainTextEditPrivate which i cant find.
    In the source code I was searching for the code when you click on the editor the cursor moves there.
    It should covert a QPoint to a valid QTextCursor pos. and with the textcursor I could easily get the text.

    Thanks.



  • Try to get QTextCursor using QPlainTextEdit::cursorForPosition. Remember to pass valid QPoint translated to QPlainTextEdit viewport coordinates.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.