better url handling

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-07-06 18:46:59 +03:00
parent f0aab541f8
commit 93870c315f
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -46,7 +46,7 @@
void setupLinkToolTip(QLabel* label)
{
QObject::connect(label, &QLabel::linkHovered, [label](const QString& link) {
if (!link.isEmpty() && !link.startsWith("http"))
if (auto url = QUrl(link); !url.isValid() || (url.scheme() != "http" && url.scheme() != "https"))
return;
label->setToolTip(link);
});