Unsolved Displaying a new QML window from one window with overlapping
-
Basically I have a screen in QML from which I want to display a new screen overlapping the previous screen. I have tried using LOADER but my new screen is not overlapping the existing one and i have two screens on the display which is not desirable .. can anyone come up with a solution or guidance ?
-
Looks like your new component is also Window type. Make it as Item or Rectangle. It should work.
Main.qml
Window {
Loader{id : ld}
MouseArea{
anchors.fill : parent
ld.source = "Second.qml"
}
}Second.qml
Item {}
If not paste your code here.
-
This post is deleted! -
this is my main .qml:
import QtQuick 2.5
import QtQuick.Window 2.2Window {
visible: true
width: 640
height: 480
color:"white"
title: qsTr("Hello World")Rectangle{
id:root
anchors.centerIn: parent
height:50
width:50
color:"blue"property real xpos: mou.mouseX
property real ypos: mou.mouseYLoader{
id:pageloader
}function pos()
{
if((xpos==mou.mouseX) && (ypos==mou.mouseY))// console.log("MC")
onClicked: pageloader.source = "Page1.qml"
}MouseArea{
id: mou
hoverEnabled: true
anchors.fill: rootTimer{ id:time2 interval:3000 running: true repeat: true onTriggered: root.pos() }
}
}
Page1.qml:
import QtQuick 2.5
import QtQuick.Window 2.2
import
Window {
id:basevisible: true
width: 640
height: 480
color:"white"
title: qsTr("Hello World")}
basically after 3 sec , page1 should replace the main qml
-
Change the Page1.qml to the following. It should work fine.
Rectangle {
id:basevisible: true width: 640 height: 480 color:"white"
}