Hi all,

I have a weird issue. I'm trying to display a tooltip on a QPlainTextEdit subclass, and the tooltip is shown too much above the mouse cursor. I'm currently showing the word under the mouse cursor. I basically used the code here:
http://developer.qt.nokia.com/faq/an...rd_in_a_qlabel

Qt Code:
  1. bool logEditor::event(QEvent *event)
  2. {
  3. if (event->type() == QEvent::ToolTip)
  4. {
  5. processTooltip(static_cast <QHelpEvent*>(event)->pos(),static_cast <QHelpEvent*>(event)->globalPos());
  6. return true;
  7. }
  8.  
  9. return QPlainTextEdit::event(event);
  10. }
  11.  
  12. void logEditor::processTooltip(QPoint pos, QPoint globalpos)
  13. {
  14. QPoint adjustedPos=pos;
  15. adjustedPos.setX(adjustedPos.x()-lineNumberAreaWidth());
  16. QTextCursor cursor = cursorForPosition(adjustedPos);
  17. cursor.select(QTextCursor::WordUnderCursor);
  18. QToolTip::showText(globalpos, cursor.selectedText());
  19.  
  20. }
To copy to clipboard, switch view to plain text mode 

And see the result:
screen.jpg

The word displayed is the correct word, but the position is wrong...