设计第二个弹出窗口(MessageBox)

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.0
import "./MySdk.js"  as  SDK
import "./GooleGooleColor.js"  as  GooleColor
Popup {
    property string titletxt: "标题.."
    property string  texttxt: "锤子科技初创伊始,钱晨作为合伙人的身份加盟,填补了硬件的短板。罗永浩形容钱晨的加盟是“挖到了宝”,多次在公开场合不无骄傲的夸赞钱晨,如今钱晨离职,锤子手机T3发布在即,你还看好锤子的未来吗?"
    property color bkcolor: GooleColor.浅蓝色["500"]
    property color fontcolor:GooleColor.青["A200"]
    property color btncolor: GooleColor.紫["200"]
    property color splitcolor:GooleColor.蓝["200"]
    Material.accent: bkcolor
    Material.background: fontcolor
    Material.foreground:   bkcolor
    Material.theme: Material.Light
    id:msgroot
    modal:true
    width: parent.width
    height: parent.height
    closePolicy: Popup.CloseOnEscape
    background: Item{}
    Item {
        id:rootitem
        width: 0
        height: parent.height*0.8
        anchors.centerIn: parent
        Behavior on width{NumberAnimation{duration: 666}}
        Rectangle{
            id:bk
            radius: 8
            border.color: "#cccccc"
            anchors.fill: parent
            color: "#f090C2"
            Behavior on color{PropertyAnimation{duration: 1000}}


            Flickable{
                id:flick
                width: parent.width
                height: parent.height-ok.height
                contentHeight: col.height
                clip: true
                ScrollBar.vertical: ScrollBar{}
                Column{
                    id:col
                    width: parent.width
                    spacing: 2
                    Text {
                        id: title
                        text:titletxt
                        font.family: "微软雅黑"
                        x:col.width/2 -width/2
                        font.pixelSize: 18
                        color: "red"
                        font.bold: true
                        Behavior on color{PropertyAnimation{duration: 1000}}

                    }

                    Rectangle{id:split;
                        width: col.width*0.95;height: 5;}
                    Item {
                        width: 1
                        height: 20
                    }
                    Label{
                        id:text
                        wrapMode: Text.WrapAnywhere
                        font.pixelSize: 20
                        font.family: "微软雅黑"
                        font.bold: true
                        color: "red"
                        text:texttxt
                        width:col.width*0.8
                        x:col.width/2 -width/2
                        Behavior on opacity{NumberAnimation{duration: 1666}}
                        Behavior on color{PropertyAnimation{duration: 1000}}
                    }


                }
            }

            Button{
                id:ok
                text:"确定"
                width: 80
                height: 40
                y:-1000
                x:col.width/2 -width/2
                clip:true
                Behavior on width{NumberAnimation{duration: 2000;easing.type: Easing.OutInBounce} }
                Behavior on y{SpringAnimation{spring: 20; damping: 0.2;mass:2} }
                Timer{
                    id:changgeWidth
                    triggeredOnStart: true
                    repeat: true
                    running: false
                    interval: 2000
                    onTriggered: {
                        console.log("动画")
                        ok.width =suijishu(120,60)
                    }
                }

                onClicked: {
                    close()
                }
            }


            layer.enabled: true
            layer.effect: DropShadow {
                antialiasing: true
                transparentBorder: true//绘制边框阴影
                color:"#000000";
                radius: 10;
                spread: 0.1
            }
        }

        states: [
            State {
                name: "open";when: msgroot.visible==true;
                PropertyChanges { target: rootitem ;width: parent.width*0.8}
                PropertyChanges { target: bk ;color:bkcolor}  //背景色
                PropertyChanges { target: title ;color:fontcolor}//标题文字颜色
                PropertyChanges { target: text ;color:fontcolor}//文字颜色
                PropertyChanges { target: split ;color:splitcolor}//标题下方分割线的颜色
                PropertyChanges { target: text ;opacity:1}
                PropertyChanges { target: ok ;y:flick.height}
                PropertyChanges { target: changgeWidth ;running:true}
            }
        ]
    }



    function  suijishu(max,min)
    {
        return  Math.random()*(max-min+1)+min;
    }
    signal callback();
    onClosed: {
            callback()
    }

}

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值