Hi everyone.
I've developed a component for my application that uses drag and drop of it's items without any major issues. I have a collection of QLabels (class that extends QLabel), that I allow the user to reorder it by dragging each one. The drag and drop operation may occur only inside the component (the QLabel collection) for now.
The problem is, when I try to integrate it with my application, it does not work the way I expect - I detect a "forbidden area" every time I try to move one label.
The code below is from the class that extends QLabel. This code is supposed to "detect" the invalid drags. When isolated, the component works just fine, but inside my application, It never enters that "if(!drag->exec())".
Qt Code:
  1. if (this)
  2. {
  3. this->setScaleFactor(1);
  4. QMimeData *mimeData = new QMimeData;
  6. mimeData->setText(QString::number((int)this));
  8. QDrag *drag = new QDrag(this);//this);
  9. drag->setMimeData(mimeData);
  10. if(!drag->exec(Qt::CopyAction | Qt::MoveAction))
  11. {
  12. qDebug()<<"Invalid area";
  13. emit(signal_draggedInInvalideArea(this));
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

Can anyone help me on this? This method is called when the drag action is detected (when I start to drag, this method is called).