0

This question is not specific for the Ubuntu platform, but as I am developing an Ubuntu Touch app, I'd like to ask first here.

I have a list of UbuntuShapes arranged in a GridView - generated from a ListModel object - and a Rectangle object with a MouseArea that I can drag all around the application's MainView. What I want to do is that if the mouse releases the rectangle over an UbuntuShape, it executes an action associated with that one UbuntuShape.

Considering that:

  • I cannot assign an ID to each object generated by a ListView/GridView's delegate
  • I cannot use a JavaScript function as an argument for a new ListElement
  • I cannot dynamically add items to a Flickable/GridView and make them scrollable
  • I cannot use a MouseArea's entered signal if it is under another MouseArea

how could I detect if the rectangle is over an specific UbuntuShape from the GridView?

Xerz
  • 4,591
  • 3
  • 23
  • 37

1 Answers1

0

It sounds like you should be using Drag and Drop in addition to just MouseArea, as shown in https://developer.ubuntu.com/api/apps/qml/current/QtQuick.Drag/

mhall119
  • 5,017
  • 15
  • 25
  • I'm having trouble using the onDropped signal. However, seems like this is what I was looking for. Thank you! – Xerz Jul 05 '15 at 15:32
  • This fixed the onDropped problem, BTW! http://askubuntu.com/questions/301145/how-to-emit-ondropped-in-qml-drag-n-drop-example – Xerz Jul 05 '15 at 15:56