how to open one window from another with qml
- 
Assign the id property for the first window. Inside the handler you can say id.visible = false;
wrote on 16 Dec 2018, 08:03 last edited by@dheerendra realized now that the second window does not open as a new window , it opens inside the first window and when i give the command to set as false the first window visibility it closes both windows
 - 
show me the code change you have done.
 - 
wrote on 16 Dec 2018, 08:16 last edited by
import QtQuick 2.9
import QtQuick.Controls 2.4ApplicationWindow {
id: lol visible: true width: 640 height: 480 title: qsTr("Hello World") Loader{ id : ld } Frame { width: 300 height: 400 anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenterColumn {
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;spacing: 5; Label{ width: 200 height: 30 anchors.horizontalCenter: Column.horizontalCenter; //anchors.verticalCenter: Column.verticalCenter text: "FACEBOOK" color: "black" visible: true } TextField{ text: "username " width: 200 height: 30 anchors.horizontalCenter: Column.horizontalCenter; anchors.verticalCenter: Column.verticalCenter; visible: true } TextField{ text: "password " width: 200 height: 30 anchors.horizontalCenter: Column.horizontalCenter; anchors.verticalCenter: Column.verticalCenter; visible: true } Button{ width: 200 height: 30 anchors.horizontalCenter: Column.horizontalCenter; anchors.verticalCenter: Column.verticalCenter; text: "loggin" visible: true onClicked: { console.log("Dheerendra Window Clicked") ld.source = "page2.qml" lol.visible = false } } }}
}
 - 
wrote on 16 Dec 2018, 08:29 last edited by
 - 
After looking at this image I have question. Why do you want to show another windows ? Is it the error message you wanted to show ? if this the case you can show dialog.
 - 
I tried with you code now. When I launch it starts the user/password window. When I click on log button, it closes user/pass windows and shows the new window. Can you show what is available in Page2.qml ? Is it starting from Window as root element ? Looks like your Page2.qml qml root is not Window. Confirm the same.
 - 
After looking at this image I have question. Why do you want to show another windows ? Is it the error message you wanted to show ? if this the case you can show dialog.
wrote on 16 Dec 2018, 21:33 last edited by@dheerendra i wanted to open the program main window from the login button
 - 
I tried with you code now. When I launch it starts the user/password window. When I click on log button, it closes user/pass windows and shows the new window. Can you show what is available in Page2.qml ? Is it starting from Window as root element ? Looks like your Page2.qml qml root is not Window. Confirm the same.
wrote on 16 Dec 2018, 21:47 last edited by@dheerendra it doesn't shows the new window to me.
yes the page 2 window is not starting as a root element - 
wrote on 16 Dec 2018, 22:03 last edited by
 - 
wrote on 16 Dec 2018, 22:23 last edited by
 
16/16


