PDA

View Full Version : How to get QTextCursor under QCursor in QTextEdit?



XL
11th April 2009, 22:56
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!

wysota
11th April 2009, 23:27
Use QText::cursorForPosition(). Just remember the point has to be in viewport coordinates.