Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved Displaying a new QML window from one window with overlapping

    QML and Qt Quick
    2
    5
    1828
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      vishu_fcb last edited by

      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 ?

      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by dheerendra

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply Reply Quote 2
        • V
          vishu_fcb last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • V
            vishu_fcb last edited by

            @dheerendra

            this is my main .qml:
            import QtQuick 2.5
            import QtQuick.Window 2.2

            Window {
            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.mouseY

            Loader{
            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: root

            Timer{
                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:base

            visible: true
            width: 640
            height: 480
            color:"white"
            title: qsTr("Hello World")

            }

            basically after 3 sec , page1 should replace the main qml

            1 Reply Last reply Reply Quote 0
            • dheerendra
              dheerendra Qt Champions 2022 last edited by

              Change the Page1.qml to the following. It should work fine.

              Rectangle {
              id:base

              visible: true
              width: 640
              height: 480
              color:"white"
              

              }

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply Reply Quote 2
              • First post
                Last post