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. mouse area pin mode
Forum Updated to NodeBB v4.3 + New Features

mouse area pin mode

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 242 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.
  • M Offline
    M Offline
    MehrdadPilevar
    wrote on last edited by
    #1
    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
    	width: 640
    	height: 480
    	visible: true
    	title: qsTr("Hello World")
    
    	Rectangle{
    		color: "red"
    
    		width: 300
    		height: 300
    
    		x:10
    		y:10
    
    		MouseArea{
    			anchors.fill: parent
    			hoverEnabled: true
    			
    
    
    			onExited: {
    				console.log("exit red")
    			}
    			onEntered: {
    				console.log("enter red")
    			}
    			onMouseXChanged: {
    
    				console.log("x mouse red"+mouseX)
    			}
    			onMouseYChanged: {
    				console.log("y mouse red"+mouseY)
    
    			}
    		}
    
    	}
    
    	Rectangle{
    		color: "green"
    
    		width: 100
    		height: 100
    
    		x:130
    		y:10
    
    		MouseArea{
    			anchors.fill: parent
    			hoverEnabled: true
    
    
    
    			onExited: {
    				console.log("exit green")
    			}
    			onEntered: {
    				console.log("enter green")
    			}
    
    		}
    	}
    
    }
    

    In this part, I have two rectangles and inside each rectangle, there is a mouse area
    In this part, I want to do the pin mode with the Aria mouse, but the problem is that when the next rectangle, which is located on the lower rectangle, is removed from the Aria mouse, the window can not be opened at the top.

    Exactly so that you can use the mouse's position in mouse area when there is a button on mouse area, for example, and that the mouse area is on the button does not allow us to exit the mouse area.

    Thanks for the support

    1 Reply Last reply
    0
    • F Offline
      F Offline
      flowery
      wrote on last edited by
      #2

      I am not getting your problem. Are you looking for something like this to print x and y when there is a position change.
      onPositionChanged: {
      console.log("x:"+ mouse.x+ " y:"+mouse.y)
      }

      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