سؤال

In my QML Text element I want to have a hyperlink to a website and managed to do so with it looking like one etc. but when I click or touch it nothing happens, the link is supposed to open in a the default browser.

Text {
    id: link_Text
    text: '<html><style type="text/css"></style><a href="http://google.com">google</a></html>'
}

Any idea what I'm doing wrong?

هل كانت مفيدة؟

المحلول

Ok I just found that I have to add this:

onLinkActivated: Qt.openUrlExternally(link)

I did not originally consider something like this because I thought if the string was correctly formatted it would open the link on its own.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top