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. Detect "is_on_top" in QML StackView. How?
Forum Updated to NodeBB v4.3 + New Features

Detect "is_on_top" in QML StackView. How?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 201 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.
  • B Offline
    B Offline
    bogong
    wrote on 16 Apr 2021, 17:26 last edited by
    #1

    Hello all!
    I need to detect that the QML Object is on top of StackView. Is there any way to do it?
    For example:

    StackView {
    
    	id: oStackView;
    	width: parent.width;
    	height: parent.height;
    
    	Component.onCompleted: {
    		oStackView.push(oScreenLogin);
    	}
    
    	Component {id: oScreenLogin; SScreenLogin {}}
    	Component {id: oScreenSearch; SScreenSearch {}}
    	Component {id: oScreenTest; SScreenTest {}}
    }
    

    I need to detect inside of oScreenLogin that it is on top of StackView. How to do it?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bogong
      wrote on 16 Apr 2021, 17:34 last edited by
      #2

      Solution found. Issue closed.
      Inside of SScreenLogin:

      property string pObjectName: "SScreenLogin";
      
      id: oRoot;
      objectName: oRoot.pObjectName;
      

      And inside of JS script:

      if (oStackView.currentItem.objectName == oRoot.pObjectName) {
      	On top
      } else {
      	Not on top
      }
      
      1 Reply Last reply
      0

      1/2

      16 Apr 2021, 17:26

      • Login

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