diff --git a/Changelog b/Changelog index 221ab862..0f8adc98 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ - Introduce DockWidget::setFloatingWindowFlags(flags). Allows for different FloatingWindows to have different window flags. For example, some having Qt::Tool while others having Qt::Window (#314). + - Fixed fixed-sized windows being able to be resized on Windows (#345) * v1.6.0 (14 September 2022) - Minimum Qt6 version is now 6.2.0 diff --git a/src/private/WidgetResizeHandler.cpp b/src/private/WidgetResizeHandler.cpp index 59e4cd72..a8909db8 100644 --- a/src/private/WidgetResizeHandler.cpp +++ b/src/private/WidgetResizeHandler.cpp @@ -369,6 +369,7 @@ bool WidgetResizeHandler::handleWindowsNativeEvent(QWindow *w, MSG *msg, const int borderWidth = 8; const bool hasFixedWidth = w->minimumWidth() == w->maximumWidth(); const bool hasFixedHeight = w->minimumHeight() == w->maximumHeight(); + const bool hasFixedWidthOrHeight = hasFixedWidth || hasFixedHeight; *result = 0; const int xPos = GET_X_LPARAM(msg->lParam); @@ -376,13 +377,13 @@ bool WidgetResizeHandler::handleWindowsNativeEvent(QWindow *w, MSG *msg, RECT rect; GetWindowRect(reinterpret_cast(w->winId()), &rect); - if (xPos >= rect.left && xPos <= rect.left + borderWidth && yPos <= rect.bottom && yPos >= rect.bottom - borderWidth && features.hasResize()) { + if (!hasFixedWidthOrHeight && xPos >= rect.left && xPos <= rect.left + borderWidth && yPos <= rect.bottom && yPos >= rect.bottom - borderWidth && features.hasResize()) { *result = HTBOTTOMLEFT; - } else if (xPos < rect.right && xPos >= rect.right - borderWidth && yPos <= rect.bottom && yPos >= rect.bottom - borderWidth && features.hasResize()) { + } else if (!hasFixedWidthOrHeight && xPos < rect.right && xPos >= rect.right - borderWidth && yPos <= rect.bottom && yPos >= rect.bottom - borderWidth && features.hasResize()) { *result = HTBOTTOMRIGHT; - } else if (xPos >= rect.left && xPos <= rect.left + borderWidth && yPos >= rect.top && yPos <= rect.top + borderWidth && features.hasResize()) { + } else if (!hasFixedWidthOrHeight && xPos >= rect.left && xPos <= rect.left + borderWidth && yPos >= rect.top && yPos <= rect.top + borderWidth && features.hasResize()) { *result = HTTOPLEFT; - } else if (xPos <= rect.right && xPos >= rect.right - borderWidth && yPos >= rect.top && yPos < rect.top + borderWidth && features.hasResize()) { + } else if (!hasFixedWidthOrHeight && xPos <= rect.right && xPos >= rect.right - borderWidth && yPos >= rect.top && yPos < rect.top + borderWidth && features.hasResize()) { *result = HTTOPRIGHT; } else if (!hasFixedWidth && xPos >= rect.left && xPos <= rect.left + borderWidth && features.hasResize()) { *result = HTLEFT;