TextEditor: Avoid some deprecation warnings

Change-Id: I05ceed344086f1cf75926f132422a1e0ae30cf08
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2024-06-06 14:24:23 +02:00
parent f65c54fa3e
commit 8a6e1d6c06

View File

@@ -7577,7 +7577,7 @@ bool TextEditorWidget::openLink(const Utils::Link &link, bool inNextSplit)
#endif #endif
QString url = link.targetFilePath.toString(); QString url = link.targetFilePath.toString();
if (url.startsWith(u"https://"_qs) || url.startsWith(u"http://"_qs)) { if (url.startsWith(u"https://") || url.startsWith(u"http://")) {
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
return true; return true;
} }
@@ -7616,11 +7616,12 @@ void TextEditorWidgetPrivate::requestUpdateLink(QMouseEvent *e)
return; return;
// Check that the mouse was actually on the text somewhere // Check that the mouse was actually on the text somewhere
bool onText = q->cursorRect(cursor).right() >= e->x(); const int posX = e->position().x();
bool onText = q->cursorRect(cursor).right() >= posX;
if (!onText) { if (!onText) {
QTextCursor nextPos = cursor; QTextCursor nextPos = cursor;
nextPos.movePosition(QTextCursor::Right); nextPos.movePosition(QTextCursor::Right);
onText = q->cursorRect(nextPos).right() >= e->x(); onText = q->cursorRect(nextPos).right() >= posX;
} }
if (onText) { if (onText) {