使用 Qt Creator 创建简单的登录表单,无需任何 QtQuickControls

使用 Qt Creator 创建简单的登录表单,无需任何 QtQuickControls

我是 Qt Creator 的新手。我想在 qml 中构建一个带有提交按钮的简单表单(例如登录表单),但不使用任何导入 QtQuick.Controls。如何使用 Rectangle 组件创建按钮?(即使用 Qt Quick-Basic)

有人可以帮忙解决这些问题吗?

答案1

我找到了上述问题的答案:

以下是代码:

import QtQuick 1.0

Rectangle{
    id:screen
    color: "lightgray"
    width: 3000; height:2700

    Column {
        id: column1
        width: 201
        height: 400

        Row {
            id: row1
            width: 40
            height:50

            TextInput {
                id: userName
                x: 40
                y: 18
                width: 80
                height: 20
                text: qsTr("UserName")
                font.pixelSize: 12
            }

            Rectangle {
                id: rectangle1
                x: 115
                y: 18
                width: 80
                height: 20
                color: "#ffffff"
            }


        }

        Row {
            id: row2
            width: 40
            height: 50

            TextInput {
                id: password
                x: 40
                y: 18
                width: 80
                height: 20
                text: qsTr("Password")
                font.pixelSize: 12
            }

            Rectangle {
                id: rectangle2
                x: 115
                y: 18
                width: 80
                height: 20
                color: "#ffffff"
            }
        }

        Row {
            id: row3
            x: 8
            y: 113
            width: 40
            height: 50

            Rectangle {
                id: rectangle3
                x: 8
                y: 8
                width: 80
                height: 20
                color: "#ffffff"

            Text {
                id: login
                text: "Login"
                x:4
                y:4
                width:30
                height:10
                font.pixelSize: 12
            }
        }
    }
}

相关内容