使用QML制作超链接并打开超链接
来源:互联网 发布:淘宝的宝贝卖点填什么 编辑:程序博客网 时间:2024/05/21 21:39
使用QML中的Text来实现超链接并打开
代码如下:
import QtQuick 2.3import QtQuick.Window 2.2Window { visible: true MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } MouseArea{ anchors.centerIn: parent width: hp.width height: hp.height hoverEnabled: true cursorShape: containsMouse ? (pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor) : Qt.ArrowCursor Text { id: hp text: "<a href='http://www.baidu.com'><h1>点击进入首页</h1></a>" anchors.centerIn: parent onLinkActivated: Qt.openUrlExternally(link) } }}
只要为text属性复制上HTML中的<a>元素就可变成超链接,使用Qt.openUrlExternally来打开它。
利用MouseArea来实现鼠标放上超链接时候的样式。
看看效果图:
点击之后就会使用默认浏览器打开http://www.baidu.com
是不是很简单? over.
0 0
- 使用QML制作超链接并打开超链接
- Qml超链接
- 使用VC打开超链接
- 使用静态文本控件制作超链接
- 使用超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- 超链接
- c++ 查找一个字符串中逗号的个数,并分别获取以逗号分隔的数值(此处设为字符串形式)
- 对W3C的理解
- jqGrid 使用知识点记录
- TensorFlow-3: 用 feed-forward neural network 识别数字
- vs2013设置快捷键、快捷输入(番茄助手)
- 使用QML制作超链接并打开超链接
- Android中Volley发送带有Cookie信息的请求
- Educational Codeforces Round 3 E. Minimum spanning tree for each edge MST+树上路径倍增
- 加快Android Studio的编译速度
- Plug-in JFace查看器
- GIS开源软件大全
- [Android]Ubuntu编译AOSP
- TensorFlow-4: tf.contrib.learn 快速入门
- Retrofit2.0 简单使用总结