Text {
anchors.centerIn: parent
text: '<html></style><a href="http://www.baidu.com">点击</a></html>'
MouseArea {
anchors.fill: parent;
hoverEnabled: true;
cursorShape:
(containsMouse? Qt.PointingHandCursor: Qt.ArrowCursor);
onClicked: Qt.openUrlExternally("http://www.baidu.com")
}
}
文本使用html超链接显示, 被点击的时候调用Qt.openUrlExternally来使用默认应用打开超链接
![](https://img.haomeiwen.com/i9742464/85187cdc1ebae4da.gif)
需要完整代码请访问QtQuickExamples
网友评论