使用HTML语法图文混排

注:指定像素大小不可使用HTML的px语法

 Flickable {
        anchors.fill: parent
        contentWidth: parent.width
        contentHeight: col.height + 20

        Column {
            id: col
            x: 10; y: 10
            spacing: 20
            width: parent.width - 20
            property var hAlign: Text.AlignLeft

            Loader{
                property string txt:"<h2>指定大小</h2>:<img width='48' height='48' src='qtlogo.png' \><br>" +
                                    "<h2>对齐middle</h2>:<img align='middle' width='48' height='48' src='qtlogo.png' \><br>"+
                                    "<h2>对齐top</h2>:<img align='top' width='48' height='48' src='qtlogo.png' \><br>"+
                                    "<h2>对齐bottom</h2>:<img align='bottom' width='48' height='48' src='qtlogo.png' \><br>"+
                                    "<h2>指定大小</h2>:<img width='32' height='32' src='qtlogo.png' \>" +
                                    "<img width='48' height='48' src='qtlogo.png' \>" +
                                    "<img width='72' height='72' src='qtlogo.png' \>"




                width: parent.width;
                sourceComponent: component

            }

        }


        Component{
            id:component;
                Text {
                    id:subtext;
                    text: parent.txt
                    width: parent.width
                    font.pointSize: 14
                    wrapMode: Text.WordWrap
                    textFormat: Text.StyledText
                    horizontalAlignment: root.hAlign
                }




        }
    }

这里写图片描述
这里写图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值