• QML登录界面


    import QtQuick 2.9
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.2
    import QtGraphicalEffects 1.0
    import QtQuick.Layouts 1.3
    ApplicationWindow {
        id: root
        visible: true
         Screen.width
        height: Screen.height
        title: qsTr("登录雷达作战系统")
        Component.onCompleted: {
            root.visibility = Window.Maximized
        }
        Image {
            anchors.fill: parent
            source: "qrc:/img/earth.jpg"
        }
    
        Item {
             650
            height: 650
            anchors.centerIn: parent
            //一个圆形图片
            Item {
                 parent.width
                height: parent.height
                Image {
                    id: rdJpg
                    anchors.centerIn: parent
                    smooth: true
                    visible: false
                    source: "qrc:/img/rd.jpg"
                }
                Rectangle {
                    id: mask
                     parent.width
                    height: parent.height
                    radius: width/2
                    visible: false
                }
                OpacityMask {
                    anchors.fill: parent
                    source: rdJpg
                    maskSource: mask
                }
            }
    
            //用户输入
            Item {
                 250
                height: 100
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 100
                anchors.horizontalCenter: parent.horizontalCenter
    
                GridLayout {
                    id: grid
                    rows:2
                    columns: 2
                     250
                    height: 60
                    columnSpacing: 10
                    Text {
                        text: qsTr("用户名")
                        font.pointSize: 12
                        color: "black"
                    }
                    TextField {
                        id: filedUsr
                        Layout.preferredHeight: 30
                    }
                    Text {
                        text: qsTr("密码")
                        font.pointSize: 12
                        color: "black"
                    }
                    TextField {
                        id: filedPawd
                        Layout.preferredHeight: 30
                    }
                }
    
                //登录按钮
                Rectangle {
                    id: logBtn
                     200
                    height: 33
                    color: "#6facf9"
                    radius: 4
                    border. 1
                    border.color: "black"
                    Text {
                        color: "#ffffff"
                        text: qsTr("登录")
                        anchors.centerIn: parent
                        font.pointSize: 12
                    }
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.top: grid.bottom
                    anchors.topMargin: 40
    
                    MouseArea {
                        anchors.fill: parent
                        hoverEnabled: true
                        onEntered: {
                            logBtn.color = "#333333"
                        }
                        onPressed: {
                            logBtn.color = "#111111"
                        }
                        onReleased: {
                            logBtn.color = "#333333"
                        }
    
                        onExited: {
                            logBtn.color = "#6facf9"
                        }
                    }
                }
            }
    
        }
    
    }

     

  • 相关阅读:
    Hibernate框架做数据库操作
    Spring AOP几个相关术语复习梳理
    Unknown initial character set index '255' received from server...
    使用IDEA的activiti时报错:发现了以元素 'process' 开头的无效内容...
    获取Class实例的4种方式
    maven设置全局和局部jdk版本
    JSP的9大内置对象和4大域对象(作用域)
    oracle中NVL,NVL2,NULLIF,COALESCE等函数
    MIME类型
    Eclipse集成Tomcat,并发布Web工程
  • 原文地址:https://www.cnblogs.com/judes/p/11247761.html
Copyright © 2020-2023  润新知