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. How to Drag over other objects?
Qt 6.11 is out! See what's new in the release blog

How to Drag over other objects?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.6k 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.
  • A Offline
    A Offline
    Agroni
    wrote on last edited by
    #1

    Can someone help me understand how to reference objects like dropbucket001, dropbucket002, dropbucket003 while I drag dragthis over those objects?

    What I am trying to do is make the dropbuckets glow or shake or some other visual effect to indicate that you can drop the object on it.

    @

    import QtQuick 1.0

    Rectangle {
    id: screen
    color: "white"
    width: 400
    height: 300

    Rectangle {
    id: dropbucket001
    x: 10
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dropbucket002
    x: 80
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dropbucket003
    x: 150
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dragthis
    x: 10
    y: 80
    color: "green"
    width: 50
    height: 50
    MouseArea {
    anchors.fill: parent
    drag.target: dragthis
    }

    }
    

    }
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      CMGeorge
      wrote on last edited by
      #2

      @Rectangle {
      id: dragthis
      x: 10
      y: 80
      color: "green"
      width: 50
      height: 50
      MouseArea {
      anchors.fill: parent
      drag.target: dragthis
      drag.axis = XandYAxis
      drag.active = true
      }

      }@
      

      iOS & Qt Developer
      Happy Qt-ing

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Agroni
        wrote on last edited by
        #3

        What are you trying to say CMGeorge?
        Did you check your code?

        [quote author="CMGeorge" date="1305232932"]@Rectangle {
        id: dragthis
        x: 10
        y: 80
        color: "green"
        width: 50
        height: 50
        MouseArea {
        anchors.fill: parent
        drag.target: dragthis
        drag.axis = XandYAxis
        drag.active = true
        }

        }@[/quote]
        
        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