Make QWindowContainer handle drag'n'drop

Drag'n'drop events were not propagated by a the QWindowContainer to the
embedded QWindow. This patch makes the widget accept the events and
pass them on

Task-number: QTBUG-40603
Change-Id: I97320fbcad27f7c6aa48c95c90bb42dda634764e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Allan Sandfeld Jensen 2014-08-18 14:13:44 +02:00
parent 97384030ef
commit 1bae226076
2 changed files with 10 additions and 0 deletions

View File

@ -85,6 +85,7 @@ class QPlatformWindow;
class QBackingStore;
class QScreen;
class QAccessibleInterface;
class QWindowContainer;
class Q_GUI_EXPORT QWindow : public QObject, public QSurface
{
@ -359,6 +360,7 @@ private:
friend class QGuiApplication;
friend class QGuiApplicationPrivate;
friend class QWindowContainer;
friend Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window);
};

View File

@ -206,6 +206,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt:
d->window = embeddedWindow;
d->window->setParent(&d->fakeParent);
setAcceptDrops(true);
connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), this, SLOT(focusWindowChanged(QWindow*)));
}
@ -298,6 +299,13 @@ bool QWindowContainer::event(QEvent *e)
}
}
break;
#ifndef QT_NO_DRAGANDDROP
case QEvent::Drop:
case QEvent::DragEnter:
case QEvent::DragMove:
case QEvent::DragLeave:
return d->window->event(e);
#endif
default:
break;
}