| 62 | } |
| 63 | |
| 64 | void CompletionProgressHandler::operateTooltip( |
| 65 | TextEditor::TextEditorWidget *editorWidget, const QPoint &point) |
| 66 | { |
| 67 | if (!editorWidget) |
| 68 | return; |
| 69 | |
| 70 | if (m_progressWidget) { |
| 71 | delete m_progressWidget; |
| 72 | } |
| 73 | |
| 74 | m_progressWidget = new ProgressWidget(editorWidget); |
| 75 | |
| 76 | if (m_cancelCallback) { |
| 77 | m_progressWidget->setCancelCallback(m_cancelCallback); |
| 78 | } |
| 79 | |
| 80 | const QRect cursorRect = editorWidget->cursorRect(editorWidget->textCursor()); |
| 81 | QPoint globalPos = editorWidget->viewport()->mapToGlobal(cursorRect.topLeft()); |
| 82 | QPoint localPos = editorWidget->mapFromGlobal(globalPos); |
| 83 | |
| 84 | localPos.rx() += 5; |
| 85 | localPos.ry() -= m_progressWidget->height() + 5; |
| 86 | |
| 87 | if (localPos.y() < 0) { |
| 88 | localPos.ry() = cursorRect.bottom() + 5; |
| 89 | } |
| 90 | |
| 91 | m_progressWidget->move(localPos); |
| 92 | m_progressWidget->show(); |
| 93 | m_progressWidget->raise(); |
| 94 | } |
| 95 | |
| 96 | } // namespace QodeAssist |
nothing calls this directly
no test coverage detected