Alterei o modelo de guia Ubuntu-SDK para ativar uma verificação de senha. Eu também sou totalmente novo no qml, mas talvez seja isso que você quer:
Projeto- > new- > ubuntu- > Ubuntu-UI-Tabs como tabstest: Aqui está o meu tabstest.qml
import QtQuick 2.0
import Ubuntu.Components 0.1
/*
example : check password before changing/showing tab
*/
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
applicationName: "tabstest"
width: units.gu(100)
height: units.gu(75)
Tabs {
id: tabs
anchors.fill: parent
// First tab begins here
Tab {
objectName: "Tab1"
title: i18n.tr("Password-Entry-tab")
// Tab content begins here
page: Page {
Column {
anchors.centerIn: parent
Label {
text: i18n.tr("this is the password check tab")
}
}
}
Column {
id: pageLayout
Label{
id : labelX
text : "Enter your paasword:"
}
TextField {
id: inputFrom
placeholderText: "password"
echoMode: TextInput.Password
}
Button {
objectName: "button"
width: parent.width
text: "Login"
onClicked: {
console.debug("onclicked...");
if(inputFrom.text == "test" ){
labelX.text = "Succesful"
console.debug(tabs.selectedTab );
tabs.visible = false
tabs2.visible = true
} else {
labelX.text = "Wrong Username or Password"
}
}
}
}
}
}
Tabs {
id: tabs2
visible: false
// Second tab begins here
Tab {
objectName: "Tab2"
title: i18n.tr("..secured tab")
page: Page {
anchors.margins: units.gu(2)
tools: ToolbarActions {
Action {
objectName: "action"
iconSource: Qt.resolvedUrl("avatar.png")
text: i18n.tr("Tap me!")
onTriggered: {
label.text = i18n.tr("Toolbar tapped")
}
}
}
Column {
anchors.centerIn: parent
Label {
id: label
objectName: "label"
text: i18n.tr("you are in secured tab.")
}
}
}
} anchors.fill: parent
}
}
considera Sascha