-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.3, 5.11.0 Beta 2
-
None
-
Ubuntu 18.04 64 bit, Windows 10 64 bit
The documentation says "The drag enter event is always immediately followed by a drag move event" but there are no QDragMoveEvent event on move mouse from a child widget to a parent. Please see the screencast and the example.
#include <iostream>
#include <QtWidgets>
struct my_widget : QWidget {
my_widget() {
setAcceptDrops( true );
const auto te = new QTextEdit( this );
const auto bl = new QHBoxLayout;
bl->addSpacing( 20 );
bl->addWidget( te, 1 );
setLayout( bl );
}
void dragEnterEvent( QDragEnterEvent* e ) override {
std::cout << "ENTER: x = " << e->pos().x() << ", y = " << e->pos().y() << std::endl;
e->accept();
}
void dragLeaveEvent( QDragLeaveEvent* e ) override {
std::cout << "LEAVE" << std::endl;
e->accept();
}
void dragMoveEvent( QDragMoveEvent* e ) override {
std::cout << "MOVE: x = " << e->pos().x() << ", y = " << e->pos().y() << std::endl;
e->acceptProposedAction();
}
void dropEvent( QDropEvent* e ) override {
std::cout << "DROP: x = " << e->pos().x() << ", y = " << e->pos().y() << std::endl;
e->accept();
}
};
int main( int argc, char** argv ) {
QApplication a( argc, argv );
my_widget w;
w.show();
return a.exec();
}
ENTER: x = 31, y = 53 DROP: x = 31, y = 53
The screencast also uploaded to https://www.youtube.com/watch?v=cMYA3B2mxV0
- relates to
-
QTBUG-22987 Drag and Drop icon does not update itself appropriately when the cursor enters an invalid drop area.
-
- Closed
-
- resulted in
-
QTBUG-72844 REG->5.12 [Qt] Cannot drag text from QLineEdit and drop onto a widget unless setAcceptDrops is set on the drop site's parent
-
- Closed
-
| For Gerrit Dashboard: QTBUG-67155 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 229000,12 | widgetwindow: send DragMove for every DragEnter | dev | qt/qtbase | Status: MERGED | +2 | 0 |