PDA

View Full Version : Problem with Drag And Drop in QMainWindow - children block it.



olegfirelord
13th November 2012, 09:40
Hello.

I have a frustrating problem which I can't solve, could you please help me.

I have my main window class, subclassed from QMainWindow and central widget with lots of children. I'm trying to realize drag'n'drop functionality. In the main class I overrided QMainWindow::dragMoveEvent, QMainWindow::dragEnterEvent, QMainWindow::dropEvent functions. Also I called the method QMainWindow::setAcceptDrops( true ) in main window's constructor and QWidget::setAcceptDrops( false ) for central widget and each child of it. But I can get d'n'd functionality on the whole window - only on the window title and bounds. When I removed central widget - i got the right behavior. What have I done wrong?

Thank you for any suggestions.

olegfirelord
13th November 2012, 14:27
Ok, I made search through internet and found this post (http://stackoverflow.com/questions/9373705/qt-best-way-to-delegate-a-drag-and-drop-to-parent-widget). So I decided to solve my problem using eventFilter's of central widget it the main window and all child widgets.