이 내가 당신을 위해 그것을 만들 수있는만큼 간단합니다. 사용자 이름과 비밀번호가 저장되는 위치를 지정하지 않았습니다. 실제로 해시를 저장해야하는 경우 절대 실제 비밀번호를 저장하지 않는 것이 좋습니다. 검사를 수행하는 여기에 누락 된 C++ 메소드 (app.checkLogin())가 있습니다. 원한다면 QML로 할 수도 있습니다.
import bb.cascades 1.0
NavigationPane {
id: navigationPane
Page {
Container {
Label {
text: "Please log in"
}
TextField {
id: email
hintText: "Email address"
}
TextField {
id: password
hintText: "Password"
inputMode: TextFieldInputMode.Password
}
Button {
text: "Log in"
onClicked: {
if (email.text == "" || password.text == "") {
//display error
return;
}
if (app.checkLogin(email.text, password.text)) {
//success
navigationPane.push(second.createObject());
} else {
//display error
}
}
}
}
}
attachedObjects: [
ComponentDefinition {
id: second
source: "second.qml"
}
]
}