Anyone any ideas why this code is not working? I have a loader in main which is happily loading files the c++ spits out to it but a slightly different mechanics is required for the username/password and I thought an alias would be simpler than a signal/slot. The loader (Main.qml) has an alias which I am trying to use to go from the username to the password (Loggon_username.qml)
Main.qml
import QtQuick 2.0
Rectangle
{
id: window
property alias mainLoader: loader
Component.onCompleted:
{
loader.forceActiveFocus()
}
Rectangle
{
id: promptsContainer
width: parent.width
height: prompts.height * 1.25
color: "#2A51A3"
anchors.top: parent.top
Text
{
id: prompts //text showing what voice is saying
anchors.centerIn: parent
color: "orange"
font.pointSize: 20 //coreMenu.promptsFontPointSize
width: parent.width * 0.9
wrapMode: Text.WordWrap
clip: true
}
}
Loader
{
id: loader
height: window.height - promptsContainer.height
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
visible: source != ""
source: "Loggon_password.qml"
onSourceChanged: console.log(loader.source);
}
Keys.onPressed:
{
QMLManager.handleKey(event.key)
loader.source = QMLManager.getLoaderSource()
console.log(loader.source)
}
}
Loggon_username.qml
import QtQuick 2.0
Rectangle
{
anchors.fill: parent;
Component.onCompleted:
{
// promptsBar.text = qsTr("Please enter your MTM username");
}
TextEntry
{
title: QMLManager.getTitle();
onTextEntered:
{
QMLManager.setUsername(text);
Main.mainLoader.setSource("Loggon_password.qml")
// Main.mainLoader.source = "Help.qml"
}
}
}
↧