import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.3 Page { width: 400 height: 400 title: "" Connections { target: _qmlHandler onLoginSetUsername: { loginUsernameInput.text = username } onLoginSetStatus: { loginStatusText.text = status } onLoginEnableLoginButton: { loginLoginButton.enabled = true } onLoginDisableLoginButton: { loginLoginButton.enabled = false } onLoginSignupCheckSaveCheckbox: { loginSetDefaultCheckbox.checked = true } } ColumnLayout { anchors.fill: parent Text { Layout.alignment: Qt.AlignCenter id: loginTitle color: "#ffffff" text: qsTr("Login") horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.pixelSize: 20 } TextField { Layout.alignment: Qt.AlignCenter id: loginUsernameInput selectByMouse: true focus: true text: qsTr("") placeholderText: "Username" horizontalAlignment: Text.AlignHCenter // @disable-check M222 Keys.onReturnPressed: loginLoginButton.activate() // @disable-check M222 Keys.onEnterPressed: loginLoginButton.activate() onTextEdited: loginLoginButton.enabled = (loginUsernameInput.text != "" && loginPasswordInput.text != "") } TextField { Layout.alignment: Qt.AlignCenter id: loginPasswordInput selectByMouse: true text: qsTr("") placeholderText: "Password" horizontalAlignment: Text.AlignHCenter // @disable-check M222 Keys.onReturnPressed: loginLoginButton.activate() // @disable-check M222 Keys.onEnterPressed: loginLoginButton.activate() echoMode: TextInput.Password onTextEdited: loginLoginButton.enabled = (loginUsernameInput.text != "" && loginPasswordInput.text != "") } CheckBox { id: loginSetDefaultCheckbox Layout.alignment: Qt.AlignCenter checked: false text: "Save as default user" } Text { id: loginStatusText color: "#df3f3f" text: qsTr("") wrapMode: Text.WordWrap Layout.preferredWidth: parent.width horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter Layout.alignment: Qt.AlignCenter font.pixelSize: 20 } Button { Layout.alignment: Qt.AlignCenter id: loginLoginButton text: qsTr("Login") enabled: false font.pointSize: 16 // @disable-check M223 onClicked: { // @disable-check M222 loginLoginButton.activate() } // @disable-check M222 function activate() { // @disable-check M223 if (loginLoginButton.enabled) { // @disable-check M222 _qmlHandler.onLoginLoginButton( loginUsernameInput.text, loginPasswordInput.text, loginSetDefaultCheckbox.checked) } } } } }