Here is a sample code of what I a trying to do! When I run it QEvent::Drop is never called! I even tried using viewport() and writing a piece including dragMove but nothing works.
setAcceptDrops is true for both MainWindow and ui->EditorMdiArea Help is much needed!
Thank You
bool MainWindow::eventFilter(QObject *pFilterObj, QEvent *event) {
if((pFilterObj==ui->EditorMdiArea) && (event->type()==QEvent::Drag)) {
QDragEnterEvent *devent = (QDragEnterEvent*)event;
qDebug()<<"Here we are 1";
devent->acceptProposedAction();
devent->accept();
}
//if((pFilterObj==ui->EditorMdiArea) && (QVariant(event->type()).toString()=="61")) {
// QDragEnterEvent *devent = (QDragEnterEvent*)event;
// qDebug()<<"Here we are 2";
// devent->accept();
//}
qDebug()<<"pFilterObj is "<<pFilterObj;
qDebug()<<"event type is "<<event->type();
//ui->EditorMdiArea->viewport()->installEventFilter(this);
//ui->EditorMdiArea->viewport()->setAcceptDrops(true);
if((pFilterObj==ui->EditorMdiArea) && (Qevent->type()==QEvent::Drop)) {
qDebug()<<" Inside pFilterObj is "<<pFilterObj;
qDebug()<<"Inside event type is "<<event->type();
QDropEvent *devent = (QDropEvent*)event;
qDebug()<<"Finaly Destination Reached";
}
}
}
}
return false;
}
I got the catch! I just added
return true
in the
if block of QEvent::Drag
and it worked like a charm! Thanks everyone :-) I wil mark it as solved