Combine mouse events with QTextEdit::anchorAt() or use QTextBrowser which has a QTextBrowser::anchorClicked() signal.