Bug in Qt 5.12 drag n'drop ?
-
@skylendar
Hi
What about test with the sample that comes with Qt ?
http://doc.qt.io/qt-5/dnd.html#examples
There are often directly available in Creator. -
I can drag from my QTreeWidget, but I can't drop anymore my icon onto my QWidget target, whereas it worked in the previous version of qt (5.11).
Everything seems ok, but the dropEvent() method of my QWidget isn't activated (setAcceptDrop() is set to true, of course)
-
@skylendar
Check the
http://doc.qt.io/qt-5/qtwidgets-draganddrop-puzzle-example.html
as it drops from ListWidget to Widget. -
@skylendar said in Bug in Qt 5.12 drag n'drop ?:
The codes are very similar
So you should modify one of them until you hit or fix the problem...
-
@skylendar
Ok but it does not seems Qt related then as those sample didn't change between
5.11 and 5.12 so if they still work it seems unlikely something broke on Qt level. -
@Christian-Ehrlicher
it's exactly what I'm doing :-£ -
@skylendar said in Bug in Qt 5.12 drag n'drop ?:
My code didn't change between 5.11 and 5.12, and suddenly it doesn't work
This does not prove that there is a bug in Qt (though there could be).
It could be a problem in your code which didn't cause issues with Qt 5.11 but does with Qt 5.12.
So, before saying there is a bug in Qt you should really prove that. -
@jsulm said in Bug in Qt 5.12 drag n'drop ?:
t prove that there is a bug in
I also have an Application which has a drag n'drop problem since I've updated to Qt 5.12.0 (macOS 10.14.2 Mojave). The eventFilter method is not called anymore with QEvent::Drop
Therefore I can not drop anything into my QLineEdit derived object...
// MyLineEdit is derived from QLineEdit bool MyLineEdit::eventFilter(QObject* object, QEvent* event) { if(m_droppable) { if(event->type() == QEvent::DragEnter) { event->accept(); } // since Qt 5.12.0 the following condition is never true! if(event->type() == QEvent::Drop) { // this line is never reached // .. } } }
-
This works fine with 5.11 and 5.12 on Linux:
class MyLineEdit : public QLineEdit { Q_OBJECT public: using QLineEdit::QLineEdit; bool eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::DragEnter) event->accept(); if (event->type() == QEvent::Drop) qDebug() << "Drop"; return QLineEdit::eventFilter(object, event); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); MyLineEdit le; le.installEventFilter(&le); le.show(); return app.exec(); } #include "main.moc"
If it does not work on Mac please open a bug report.
/edit: There were some dnd changes between 5.11 and 5.12: 10b3286313c78fa380b5fe676a7c14f3ae84f017 - it works fine on Linux, did not yet test on windows and don't have a mac...
-
Hello guys... Since we are talking about Drag and Drop. Can somebody also look into this bug report?
-
@Christian-Ehrlicher said in Bug in Qt 5.12 drag n'drop ?:
MyLineEdit
Hm... this works on mac too!
Seems to be a special constelation which doesn't work or it's a bug in specific circumstancens only...
-
@armindev said in Bug in Qt 5.12 drag n'drop ?:
Seems to be a special constelation
Is it possible to simplify your program until the bug is gone away?
-
I will try this but this will take a while ..
-
@armindev said in Bug in Qt 5.12 drag n'drop ?:
I will try this but this will take a while ..
Thx and take your time. There seems to be something wrong in a corner case and it would be really good to find it out :)