0

I'm using a Qt 5.14 QML Text component with the following code:

Text {
    text: reader.content
    onLinkActivated: Qt.openUrlExternally(link)
}

When I click a markdown link displayed in the Text component, a popup appears:

Windows 10 error popup displaying "You'll need a new app to open this qrc link", a button labeled "Look for an app in the Microsoft Store", a checked box labeled "Always use this app" and a disabled OK button

I really don't like the options; I cannot click OK to continue and I don't want to go to the Microsoft store.

Here's an example of link text that produces this behavior:

[bad link]("https://stackoverflow.com")
pixelgrease
  • 1,940
  • 23
  • 26

1 Answers1

0

The link is surrounded by quotes. Removing the quotes fixes the problem:

Text {
    text: reader.content
    onLinkActivated: Qt.openUrlExternally(link.replace(/['"]+/g, ''))
}
pixelgrease
  • 1,940
  • 23
  • 26
  • I think Windows determined it's a Qt app and assumed it was opening an embedded resource, hence the "qrc" description of the link. I got zero hits when looking for the exact error message. – pixelgrease Apr 02 '20 at 17:44
  • 1
    Certainly not. It's rather that the quotes are wrong, so My guess would be that Qt gets confused by the quotes, doesn't recognise the string as URL, and assumes a (relative) path, which is completed to a qrc URL – Frank Osterfeld Apr 02 '20 at 19:44