From b486260559ca925983e76e230984b0b2fef67a1f Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 May 2021 16:12:42 +0400 Subject: [PATCH] Don't change cursor in fixed-size windows. --- ui/platform/ui_platform_window.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ui/platform/ui_platform_window.cpp b/ui/platform/ui_platform_window.cpp index 38921e2..c133d0c 100644 --- a/ui/platform/ui_platform_window.cpp +++ b/ui/platform/ui_platform_window.cpp @@ -239,28 +239,36 @@ QMargins DefaultWindowHelper::resizeArea() const { Qt::Edges DefaultWindowHelper::edgesFromPos(const QPoint &pos) const { const auto area = resizeArea(); + const auto ignoreHorizontal = (window()->minimumWidth() + == window()->maximumWidth()); + const auto ignoreVertical = (window()->minimumHeight() + == window()->maximumHeight()); if (area.isNull()) { return Qt::Edges(); - } else if (pos.x() <= area.left()) { - if (pos.y() <= area.top()) { + } else if (!ignoreHorizontal && pos.x() <= area.left()) { + if (!ignoreVertical && pos.y() <= area.top()) { return Qt::LeftEdge | Qt::TopEdge; - } else if (pos.y() >= (window()->height() - area.bottom())) { + } else if (!ignoreVertical + && pos.y() >= (window()->height() - area.bottom())) { return Qt::LeftEdge | Qt::BottomEdge; } return Qt::LeftEdge; - } else if (pos.x() >= (window()->width() - area.right())) { - if (pos.y() <= area.top()) { + } else if (!ignoreHorizontal + && pos.x() >= (window()->width() - area.right())) { + if (!ignoreVertical && pos.y() <= area.top()) { return Qt::RightEdge | Qt::TopEdge; - } else if (pos.y() >= (window()->height() - area.bottom())) { + } else if (!ignoreVertical + && pos.y() >= (window()->height() - area.bottom())) { return Qt::RightEdge | Qt::BottomEdge; } return Qt::RightEdge; - } else if (pos.y() <= area.top()) { + } else if (!ignoreVertical && pos.y() <= area.top()) { return Qt::TopEdge; - } else if (pos.y() >= (window()->height() - area.bottom())) { + } else if (!ignoreVertical + && pos.y() >= (window()->height() - area.bottom())) { return Qt::BottomEdge; } @@ -389,7 +397,7 @@ void DefaultWindowHelper::updateCursor(Qt::Edges edges) { } else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) { window()->setCursor(QCursor(Qt::SizeVerCursor)); } else { - window()->unsetCursor(); + window()->setCursor(QCursor(Qt::ArrowCursor)); } }