用Popup仿MessageBox 支持HTML语法混排
2016-06-27 18:10
393 查看
Popup { property var subtext: "" property var subtitle: "" id: messsagebox2 x: 0 y: 0 padding: 0 background: Item{} //是否使用popup背景 // dim:false width: parent.width height: parent.height modal: true focus: true closePolicy: Popup.NoAutoClose Rectangle { id: pp width: parent.width*0.8 height: parent.height/2 anchors.centerIn: parent color: "#35C47F" radius: 5 clip: true Old.ScrollView { id:flck width: parent.width height: parent.height -mok.height Column{ id:col Text{ id:title text:subtitle font.pointSize: 24 verticalAlignment: Text.AlignVCenter padding: 15 width: parent.width height: 40 color: "#FAFCF7" wrapMode: Text.WrapAnywhere textFormat: Text.RichText BorderImage { id:closeimg source: "qrc:/HelpUI/res/XX.bmp" width: 24; height: 24 border.left: 1; border.top: 1 border.right: 1; border.bottom: 1 x:title.width - width - 5 y:title.height/2 - height/2 MouseArea{ anchors.fill: parent onClicked: { messsagebox2.close(); } } Timer{ id:tttest running: messsagebox2.visible repeat: true interval: 2000 triggeredOnStart: true//第一次先主动触发一次onTriggered onTriggered: { console.log("**one time***") dh.restart() mok.width=Math.random()*mok.height*1.7+mok.height*1.5 } } NumberAnimation { id:dh target: closeimg running: messsagebox2.visible property: "rotation" from:0 to:360 loops:1/*AnimatedSprite.Infinite*/ duration: 500 easing.type: Easing.InOutQuad } } } Rectangle{width: parent.width*0.75;height: 2;color: "#27AE61"} //内容 Text{ id: txt text: subtext font.pixelSize: 16 font.bold: true // verticalAlignment: Text.AlignVCenter // horizontalAlignment: Text.AlignHCenter color: "#FAFCF7" width: flck.width wrapMode: Text.WrapAnywhere textFormat: Text.RichText } } } //确定按钮 Button{ id:mok //居中 x:pp.width/2 -width/2 anchors.top: flck.bottom width: height*1.5 height:60 text: "确定" Material.background:"#35C37F" Material.foreground:"#FAFCF7" onClicked: { messsagebox2.close(); } Behavior on width { NumberAnimation{ duration: 2000; easing.type: Easing.OutInBounce} } } layer.enabled: true layer.effect: DropShadow { transparentBorder: true//绘制边框阴影 color: "#80000000"; radius: 30.0; id:drop; //cached: true; horizontalOffset: 0; verticalOffset: 0; samples: 16; smooth: true; } } function msg(title , txt) { subtitle = title; subtext = txt; messsagebox2.open(); } }
MyMessageBox{ id:gobalMsg } function gMessage(title,txt) { gobalMsg.msg(title,txt) } gMessage("错误","<img align='middle' src='qrc:/image/TipIcon/warning.png' width='24' height='24' \>账号密码长度不正确")
相关文章推荐
- text()/html()/val()的区别
- 我的第一份HTML简历
- XHTML 学前概述
- html 补充
- HTML head 头标签
- <html:base />标签的问题
- HTML学习笔记1-Html的全局属性
- HTML学习笔记1.2-标签语法
- HTML学习笔记1.4-添加常用的标签
- HTML学习笔记1.5-文本操作标签
- html中脚本的执行顺序
- 浅谈HTML代码中的空格和空行
- HTML特殊字符编码对照表
- html的标签中 unselectable=on 属性的作用
- html常用状态码
- html状态码
- 关于从后台向前台传递html代码在前台无法显示的问题
- swiper的基础使用(九)
- swiper的基础使用(九)
- HTML按钮控制C#程序截图并查看