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. Component render on top of all popups
Forum Updated to NodeBB v4.3 + New Features

Component render on top of all popups

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 539 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Joe McGuchan
    wrote on last edited by
    #1

    Hello all

    I have created a PointHandler that I would like to rest on top of my application, monitoring for a particular gesture (in this case, simultaneous presses in the 4 corners of the screen) to trigger an action.

    I have my object in my root componenet with a z value set so that is displaying on top of everything else. However my application shows popups, and those popups wil ldisplay on top of my PointHandler, prevent it from working properly.

    Is there a way to set a componenet to display on top of EVERYTHING, including popups?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Joe McGuchan
      wrote on last edited by Joe McGuchan
      #2

      For future reference, the only solution I was able to find here was to make my component itself a popup and give it a z value of 1000. This was not ideal however, to prevent the popup from stealing the events to the item below it, I had to do some trickery with its height and width, and then I had to repopen the popup every second because user intereaction would keep closing it.

      This only works because my component is just monitoring user input for a specific interaction, it is unworkable for any other solution.

      Here is a segment of the code I used

          // Use a popup to get the FourCornerPressArea to display over everything, including other popups.
          Controls.Popup {
              id: popup
      
              // Give this popup no width or height so it doesn't block interactions to the layer below.
              // There doesn't appear to be any other way to achieve this.
              width: 0
              height: 0
      
              margins: 0
              padding: 0
      
              modal: false
      
              z: 1000
      
              background: Item {}
              contentItem: Item {
                  MyComponent {
                      width: root.width
                      height: root.height
                  }
              }
          }
      
          Timer {
              // Because we are using a popup to get the FourCornerPressArea to display over everything, we have to reopen it
              // every few seconds, because user interaction deletes the popup.
              running: true
              repeat: true
              interval: 1000
              onTriggered: popup.open()
          }
      

      if anyone knows a better way to do this, I would apprecaite it, because this is awful.

      The only other solution I can think of is to simply remove the QtQuick Popup component from our entire app and reimplement a custom version that behaves the way we want it to.

      Ronel_qtmasterR 1 Reply Last reply
      0
      • J Joe McGuchan

        For future reference, the only solution I was able to find here was to make my component itself a popup and give it a z value of 1000. This was not ideal however, to prevent the popup from stealing the events to the item below it, I had to do some trickery with its height and width, and then I had to repopen the popup every second because user intereaction would keep closing it.

        This only works because my component is just monitoring user input for a specific interaction, it is unworkable for any other solution.

        Here is a segment of the code I used

            // Use a popup to get the FourCornerPressArea to display over everything, including other popups.
            Controls.Popup {
                id: popup
        
                // Give this popup no width or height so it doesn't block interactions to the layer below.
                // There doesn't appear to be any other way to achieve this.
                width: 0
                height: 0
        
                margins: 0
                padding: 0
        
                modal: false
        
                z: 1000
        
                background: Item {}
                contentItem: Item {
                    MyComponent {
                        width: root.width
                        height: root.height
                    }
                }
            }
        
            Timer {
                // Because we are using a popup to get the FourCornerPressArea to display over everything, we have to reopen it
                // every few seconds, because user interaction deletes the popup.
                running: true
                repeat: true
                interval: 1000
                onTriggered: popup.open()
            }
        

        if anyone knows a better way to do this, I would apprecaite it, because this is awful.

        The only other solution I can think of is to simply remove the QtQuick Popup component from our entire app and reimplement a custom version that behaves the way we want it to.

        Ronel_qtmasterR Offline
        Ronel_qtmasterR Offline
        Ronel_qtmaster
        wrote on last edited by Ronel_qtmaster
        #3

        @Joe-McGuchan on the widgets side you have this setWindowFlags(Qt::WindowStaysOnTopHint);

        on the QML side you have the property flags of Window
        flags: Qt.WindowStaysOnTopHint

        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