Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Login Application



  • Hello, i cant finde my mistake can somebody help me? here is my code import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.5
    ApplicationWindow {
    id: window ; visible: true; width: 640; height: 480; title: "Beispiel-6"

    header: ToolBar {
    id: toolBar
    contentHeight: toolButton.implicitHeight
    ToolButton {
    id: toolButton
    text: stackView.depth > 1 ? "\u25C0" : "\u2630"
    // "\u25C0" : Unicode Character black left-pointing triangle
    // "\u2630" : Unicode Character for trigram for heaven ("drawer" symbol)
    font.pixelSize: Qt.application.font.pixelSize * 1.6
    onClicked: {
    if (stackView.depth > 1) { stackView.pop() }
    else { drawer.open() }
    }
    }
    Label {
    text: stackView.currentItem.title
    anchors.centerIn: parent
    }
    }
    Drawer {
    id: drawer
    width: window.width * 0.66; height: window.height
    Column {
    anchors.fill: parent
    //ItemDelegate { // replaced by Button to show the difference
    Button {
    text: "Page 1"; width: parent.width
    onClicked: {
    stackView.push(page1Form)
    drawer.close()
    }
    }
    ItemDelegate {
    text: "Page 2"; width: parent.width
    onClicked: {
    stackView.push(page2Form)
    drawer.close()
    }
    }
    ItemDelegate {
    text: "Page 3"; width: parent.width
    onClicked: {
    stackView.push(page3Form)
    drawer.close()
    }
    }
    }
    }
    StackView {
    id: stackView
    initialItem: homeForm
    anchors.fill: parent
    }
    Component {
    id: homeForm
    Page {
    width: 600; height: 400
    title: "Home"
    Label {
    text: "You are on the home page."
    anchors.centerIn: parent
    }
    }
    }
    Component {
    id: page1Form

    Page {
    width: 600
    height: 400
    title: "Page 1"
    Label {
    text: "You are on Page 1."
    anchors.centerIn: parent
    }
    }
    }
    Component {
    id: page2Form

    Page {
    width: 600
    height: 400
    title: "Page 2"
    Label {
    text: "You are on Page 2."
    anchors.centerIn: parent
    }
    }
    }
    Component {
    id: page3Form

    Page {
    width: 600
    height: 400
    title: "Page 3"
    Label {id: label; text: "Username"}
    TextField {
    id: txtUsername; text: ""; validator: RegExpValidator { regExp: /[0-9a-zA-Z]+/ }
    // only accepts letters and numbers as valid parts of a user name
    }
    Label { id: label1; text: "Password"}
    TextField {
    id: txtPassword; text: ""; echoMode: TextInput.Password
    onAccepted: {
    if ( username === Username.text && password === Password.text) {
    status = "Hello!"; statusPopup.open()
    } else { status = "Failed"; statusPopup.open(); }
    }
    }}

    anchors.centerIn: parent
    }
    }

    I want a window "page 3" were you can enter an username and a password with enter but its overlapping or a syntax error but i dont know were


Log in to reply