QT QML初体验随笔之QQuickView(5)

添加文字关联网址

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中内容格式已经最简化,外层为单引号。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值