windows: enable drop for embedded windows
when embedding a QWindow into a native win32 window hierarchy, dragndrop is not working, as RegisterDragDrop is not called. the parent HWND is wrapped via QWindow::fromWinId(), which is topLevel, but a Qt::ForeignWindow. it's children are not topLevel. we therefore add a conditon to call RegisterDragDrop on non-topLevel windows whose parent is a Qt::ForeignWindow Change-Id: Id2bfa1130857c21566feae9cb10b62b648d86a72 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>bb10
parent
c04e7dead8
commit
98f326e9b8
|
|
@ -1033,7 +1033,17 @@ void QWindowsWindow::destroyWindow()
|
|||
void QWindowsWindow::updateDropSite(bool topLevel)
|
||||
{
|
||||
bool enabled = false;
|
||||
if (topLevel) {
|
||||
bool parentIsEmbedded = false;
|
||||
|
||||
if (!topLevel) {
|
||||
// if the parent window is a foreign window wrapped via QWindow::fromWinId, we need to enable the drop site
|
||||
// on the first child window
|
||||
const QWindow *parent = window()->parent();
|
||||
if (parent && (parent->type() == Qt::ForeignWindow))
|
||||
parentIsEmbedded = true;
|
||||
}
|
||||
|
||||
if (topLevel || parentIsEmbedded) {
|
||||
switch (window()->type()) {
|
||||
case Qt::Window:
|
||||
case Qt::Dialog:
|
||||
|
|
|
|||
Loading…
Reference in New Issue