Qt Code:
  1. void floorBoard::dragMoveEvent(QDragMoveEvent *event)
  2. {
  3. QByteArray data = event->mimeData()->data("text/uri-list");
  4. QString uri(data);
  5.  
  6. if ( event->mimeData()->hasFormat("application/x-stompbox") ||
  7. uri.contains(".syx", Qt::CaseInsensitive) &&
  8. event->answerRect().intersects(this->geometry()) )
  9. {
  10. if (children().contains(event->source()))
  11. {
  12. event->setDropAction(Qt::MoveAction);
  13. event->accept();
  14. } else {
  15. event->acceptProposedAction();
  16. };
  17. } else {
  18. event->ignore();
  19. };
  20. };
To copy to clipboard, switch view to plain text mode 

I tried with adding event->answerRect().intersects(this->geometry()) but you can still drag items outside the mainwindow?

Bit lost here, I want the drag to stop when we are outside the window but it is still active when moving over other apps like firefox.