문제

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