Solved Cant get Loader to go to the next .qml page
-
Hello, well I seem to not be able to get my Loader to work on here. I'm very new to Qt so I am probably making a novice mistake. Whenever I press the button on my home page, the Loader should load the next page.
IdeaShare.qml
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Private 1.0 //import "C:/Users/.../Documents/IdeaShare/Login.qml" Window { id:window visible: true width: 340 height: 480 property alias textEdit: textEdit title: qsTr("Share Ideas and head to greatness!") Loader { id: pageLoader anchors.fill: parent source: "Login.qml" focus: true property bool valid: item !== null} Text { id: homeScreenText text: qsTr("HEY") } Image{ id:backgroundImage x: 0 y: 0 width:340 height:480 source: "shutterstock_133871897.jpg" } Rectangle { id: button property bool checked: false property alias text : buttonText.text Accessible.name: text Accessible.description: "This button does " + text Accessible.role: Accessible.Button Accessible.onPressAction: { button.clicked() } //source: "Login.qml" height: 30 x: 30 y: 100 width: 158 gradient: Gradient { GradientStop { position: 0.00; color: "#ffffff" } } radius: 1 antialiasing: true } Text { id: buttonText y: 10 text: "press to begin" anchors.verticalCenterOffset: -106 anchors.horizontalCenterOffset: 41 font.pixelSize: 24 anchors.centerIn: parent style: Text.Sunken color: "white" styleColor: "black" } Keys.onSpacePressed: clicked() TextEdit { id: textEdit text: qsTr("") activeFocusOnPress: true font.pixelSize: 8 textFormat: Text.AutoText anchors.horizontalCenterOffset: 0 verticalAlignment: Text.AlignVCenter anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 192 Image { id: image1 x: -131 y: -10 width: 262 height: 100 source: "cooltext201590374811601.png" } } Button { id: button1 x: 90 y: 349 width: 158 height: 31 text: qsTr("Button") signal clicked2 onClicked:{ console.log(qsTr('Clicked on background. Text: "' + textEdit.text + '"')) pageLoader.source = "Login.qml" update(); // close(); } } }
when the button is pressed then Login.qml should appear
Login.qml:import QtQuick 2.4 import QtQuick.Controls 1.4 //import "C:/Users/..../Documents/IdeaShare" Item { width: 400 height: 400 property alias image3: image3 Image { id: image1 width: 400 height: 400 source: "shutterstock_133871897.jpg" anchors.bottom: parent anchors.top: parent anchors.leftMargin: parent Image { id: image2 x: 75 y: 125 width: 250 height: 100 source: "cooltext201590374811601.png" } Text { id: text1 x: 40 y: 262 width: 80 height: 40 text: qsTr("Username/Email") font.bold: false font.pixelSize: 12 } Text { id: text2 x: 40 y: 316 width: 80 height: 20 text: qsTr("Password") wrapMode: Text.NoWrap font.pixelSize: 12 } } TextField { id: textField1 x: 137 y: 263 width: 160 height: 20 text: "Username" placeholderText: qsTr("Text Field") } TextField { id: textField2 x: 137 y: 316 width: 160 text: "Password" readOnly: false placeholderText: qsTr("Text Field") } Image { id: image3 x: 150 y: 8 width: 100 height: 40 source: "cooltext202081275288009.png" } }
here is the error: Unable to assign LoginForm.ui_QMLTYPE_48 to QQuickAnchorLine
if it helps the code is under LoginForm.ui.qml, while IdeaShare.qml does not have a UI file.
I appreciate all of your responses.