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. Show on top of all

Show on top of all

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.0k 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.
  • M Offline
    M Offline
    MHermann
    wrote on last edited by
    #1

    Hi!

    How can I show a rectangle on top of all elements, also the elements that were created later.
    I tried to use the z-property. But that didn't work. There are still a lot elements on top of the rectangle.
    Any suggestions?

    Kind regards,
    MHermann

    ODБOïO 1 Reply Last reply
    0
    • M MHermann

      Hi!

      How can I show a rectangle on top of all elements, also the elements that were created later.
      I tried to use the z-property. But that didn't work. There are still a lot elements on top of the rectangle.
      Any suggestions?

      Kind regards,
      MHermann

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @MHermann Hello,
      Could you show your code ? Z must do the job

      M 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @MHermann Hello,
        Could you show your code ? Z must do the job

        M Offline
        M Offline
        MHermann
        wrote on last edited by
        #3

        @LeLev :

        Here are some code snippets.
        I have a label. When the label is clicked I want to open a new rectangle to show some infos here. I set the z-property of the rectangle to 100. But this rectangle is not shown on top of all other elements. It is only on top of that label, but below a lot of other labels and other things...

        
        Label {
            ...
            MouseArea {
                id: mouseId
                anchors.fill: parent
                onPressAndHold: {
                }
        
                onClicked: {
                    rectId.visible = true
                }
            }
        
            Rectangle {
                id: rectId
                color: Style.widgetBoxColor
                width: 600
                height: 600
                z: 100
                visible: false
        
                Image {
                    id: imageId
                    anchors.fill: parent
                }
        
                MouseArea {
                    id: rectMouseId
                    anchors.fill: parent
                    onPressAndHold: {
                    }
        
                    onClicked: {
                        rectId.visible = false
                    }
                }
            }
        }
        
        
        ODБOïO 1 Reply Last reply
        0
        • M MHermann

          @LeLev :

          Here are some code snippets.
          I have a label. When the label is clicked I want to open a new rectangle to show some infos here. I set the z-property of the rectangle to 100. But this rectangle is not shown on top of all other elements. It is only on top of that label, but below a lot of other labels and other things...

          
          Label {
              ...
              MouseArea {
                  id: mouseId
                  anchors.fill: parent
                  onPressAndHold: {
                  }
          
                  onClicked: {
                      rectId.visible = true
                  }
              }
          
              Rectangle {
                  id: rectId
                  color: Style.widgetBoxColor
                  width: 600
                  height: 600
                  z: 100
                  visible: false
          
                  Image {
                      id: imageId
                      anchors.fill: parent
                  }
          
                  MouseArea {
                      id: rectMouseId
                      anchors.fill: parent
                      onPressAndHold: {
                      }
          
                      onClicked: {
                          rectId.visible = false
                      }
                  }
              }
          }
          
          
          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @MHermann in your exemple there are no 'other labels and other things' , there is only 1 rectangle, i addes one more rectangle with z-property unset, your rectangle will be on top if z > other z. Test this

          import QtQuick 2.6
          import QtQuick.Window 2.2
          import QtQuick.Controls 2.0

          Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")

          Label {
          
              text: "Testlab"
              z:5
              MouseArea {
                  id: mouseId
                  anchors.fill: parent
                  onPressAndHold: {
                  }
          
                  onClicked: {
                      rectId.visible = true
                  }
              }
          
              Rectangle {
                  id: rectId
                  color: "red"
                  width: 600
                  height: 600
                  z: 4
                  visible: false
                  anchors.centerIn: parent
          
                  Image {
                      id: imageId
                      anchors.fill: parent
                  }
          
                  MouseArea {
                      id: rectMouseId
                      anchors.fill: parent
                      onPressAndHold: {
                      }
          
                      onClicked: {
                          rectId.visible = false
                      }
                  }
              }
          
          
          }
          
          
          Rectangle{ 
              id:autherRec
              height: 75
              width: height*2
              color: "gray"
            // z:3
          
          }
          

          }

          1 Reply Last reply
          0

          • Login

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