diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp index d73ebbec28..f60a98f392 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp @@ -2461,6 +2461,18 @@ namespace AzQtComponents placeholderRect.translate(0, -margins.bottom()); } + // Also adjust the placeholderRect by the relative dpi change from the original screen, since setGeometry uses the screen's + // virtualGeometry! + QScreen* fromScreen = dock->screen(); + QScreen* toScreen = Utilities::ScreenAtPoint(placeholderRect.topLeft()); + + if (fromScreen != toScreen) + { + qreal factorRatio = QHighDpiScaling::factor(fromScreen) / QHighDpiScaling::factor(toScreen); + placeholderRect.setWidth(aznumeric_cast(aznumeric_cast(placeholderRect.width()) * factorRatio)); + placeholderRect.setHeight(aznumeric_cast(aznumeric_cast(placeholderRect.height()) * factorRatio)); + } + // Place the floating dock widget makeDockWidgetFloating(dock, placeholderRect); clearDraggingState();