| 254 | } |
| 255 | |
| 256 | bool CodeEditor::event(QEvent* event) |
| 257 | { |
| 258 | if(!showTooltips) |
| 259 | return QPlainTextEdit::event(event); |
| 260 | |
| 261 | if(event->type()==QEvent::ToolTip) { |
| 262 | auto* helpEvent = dynamic_cast<QHelpEvent*>(event); |
| 263 | QTextCursor cursor = cursorForPosition(helpEvent->pos()); |
| 264 | cursor.select(QTextCursor::WordUnderCursor); |
| 265 | Module* m = moduleNames.value(cursor.selectedText()); |
| 266 | if(m) { |
| 267 | QRect r=cursorRect(cursor); |
| 268 | QToolTip::showText(mapToGlobal(QPoint(r.x(),r.y())), m->getDescription()); |
| 269 | } else { |
| 270 | QToolTip::hideText(); |
| 271 | } |
| 272 | return true; |
| 273 | } |
| 274 | if(event->type()==QEvent::KeyPress) { |
| 275 | QToolTip::hideText(); |
| 276 | } |
| 277 | return QPlainTextEdit::event(event); |
| 278 | } |
| 279 | |
| 280 | void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) |
| 281 | { |
nothing calls this directly
no test coverage detected