Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Detect if two items overlap
Etchelon last edited by
Hi, I'd like to know if there's a ready property or method to detect if two items, say two Text elements, overlap, so I can put enough distance between them :)
AFAIK, there's no such ready property in QML.
dasRicardo last edited by
Hmmm, i would implement a simple collision detection like bound box. "LINK....":https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection
If the elements on the same y axis it's enough to calculate the distance between the x axis and move the second element up to a distance bigger then the width of the first element.
In case of collision detection, "this":http://developer.nokia.com/community/wiki/Collision_Detection_In_QtQuick would also be a good start.