添加文字关联网址
1.环境
2.在main.qml添加
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import "QML_Kingmei/Base_1"
import "QML_Kingmei/Base"
Rectangle
{
id: mainWnd;
height: 600;
width: 960;
color: "green";
border.width: 2;
border.color: "#ff808080";
// border.color: "#ffc0c0c0";
// radius: 10;
opacity: 1; // 区分颜色透明度和窗口透明度
Image {
id: skinBackGround; // 内部调用对象名称
// 显示mainWnd的边框
height: parent.height - parent.border.width*2;
width: parent.width - parent.border.width*2;
anchors.centerIn: parent;
// image源
source: "Image/background_mainwnd.jpg";
// mainWnd可以拖动
MouseArea {
anchors.fill: parent
property variant previousPosition
onPressed: {
previousPosition = Qt.point(mouseX, mouseY)
}
onPositionChanged: {
if (pressedButtons == Qt.LeftButton) {
var dx = mouseX - previousPosition.x;
var dy = mouseY - previousPosition.y;
wndCtrl.x += dx;
wndCtrl.y += dy;
}
}
}
/// 新添加代码 /
Text {
id: stateBar;
anchors.bottomMargin: 4;
anchors.rightMargin: 8;
anchors.right: parent.right;
anchors.bottom: parent.bottom;
text: 'by <a href="http://blog.csdn.net/kingmei130283">kingmei</a>';
font.pixelSize: 20;
onLinkActivated: {
Qt.openUrlExternally(link);
}
}
///
SysBtns_Kingmei {
id: sysBtns;
y: sysBtns.anchors.rightMargin - 4;
anchors.right: parent.right;
// 槽
onMin: {
wndCtrl.showMinimized();
}
onClose: {
wndCtrl.close();
}
}
}
}
3.强调点
text中内容格式已经最简化,外层为单引号。