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
    width: Screen.width
    height: Screen.height
    title: qsTr("登录雷达作战系统")
    Component.onCompleted: {
        root.visibility = Window.Maximized
    }
    Image {
        anchors.fill: parent
        source: "qrc:/img/earth.jpg"
    }

    Item {
        width: 650
        height: 650
        anchors.centerIn: parent
        //一个圆形图片
        Item {
            width: parent.width
            height: parent.height
            Image {
                id: rdJpg
                anchors.centerIn: parent
                smooth: true
                visible: false
                source: "qrc:/img/rd.jpg"
            }
            Rectangle {
                id: mask
                width: parent.width
                height: parent.height
                radius: width/2
                visible: false
            }
            OpacityMask {
                anchors.fill: parent
                source: rdJpg
                maskSource: mask
            }
        }

        //用户输入
        Item {
            width: 250
            height: 100
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 100
            anchors.horizontalCenter: parent.horizontalCenter

            GridLayout {
                id: grid
                rows:2
                columns: 2
                width: 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
                width: 200
                height: 33
                color: "#6facf9"
                radius: 4
                border.width: 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"
                    }
                }
            }
        }

    }

}

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

朱小勇本勇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值