Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Displaying a new QML window from one window with overlapping

Displaying a new QML window from one window with overlapping

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 2.9k Views
  • 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 Offline
    V Offline
    vishu_fcb
    wrote on last edited by
    #1

    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
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by dheerendra
      #2

      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
      2
      • V Offline
        V Offline
        vishu_fcb
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • V Offline
          V Offline
          vishu_fcb
          wrote on last edited by
          #4

          @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
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Qt Champions 2022
            wrote on last edited by
            #5

            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
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved