Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.0.0 Beta 1
-
None
-
Ubuntu 12.04, Xcb
-
03fd3a8f34679793b87a5d901202ea2805b89d84
Description
1) Run application;
2) Click inside the applications window to start a drag, drag to termial window.
Expected: The dragged text appears in terminal window.
Actual: No changes in a terminal window.
#include <QtWidgets/QMessageBox> #include <QtCore/QDebug> #include <QtGui/QDropEvent> #include <QtGui/QDrag> #include <QtGui/QClipboard> #include <QtWidgets/QInputDialog> #include <QtWidgets/QLabel> #include <QtWidgets/QApplication> #include <QtCore/QMimeData> #include <QtCore/QBuffer> #include <QtGui/QImage> #include <QtGui/QPixmap> //#include <QtGui> //#include <QtCore> class MyWidget : public QLabel { Q_OBJECT public: MyWidget() : QLabel(0) { setMinimumSize(QSize(200, 200)); setAcceptDrops(true); } protected: virtual void mouseMoveEvent(QMouseEvent*) { QDrag* drag = new QDrag(this); QMimeData* mimeData = new QMimeData; mimeData->setText(text()); drag->setMimeData(mimeData); drag->exec(); } virtual void dragEnterEvent(QDragEnterEvent* event) { //qDebug() << "dragEnterEvent: " << event->proposedAction(); event->acceptProposedAction(); } virtual void dragMoveEvent(QDragMoveEvent* event) { //qDebug() << "dragMoveEvent: " << event->proposedAction(); event->acceptProposedAction(); } virtual void dropEvent(QDropEvent* event) { const QMimeData* mimeData = event->mimeData(); if (mimeData->hasText()) { qWarning("retrieving text"); setText("#" + mimeData->text() + " yo"); } qDebug() << "done with data"; event->acceptProposedAction(); } }; int main( int argc, char ** argv ) { QApplication app(argc, argv); qDebug() << "V: " << qVersion(); MyWidget w1; w1.setText("Drag/drop widget"); w1.show(); return app.exec(); } #include "dnd_modaldlg.moc"
Attachments
Issue Links
- is required for
-
QTBUG-27319 Qt 5.0 Beta 2 tasks
- Closed