From a9c08552c898f611599126d431fb092934a82fd4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 17 Feb 2021 22:04:52 +0400 Subject: Check if resize area is null --- Telegram/SourceFiles/window/window_title_qt.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/window/window_title_qt.cpp b/Telegram/SourceFiles/window/window_title_qt.cpp index ce05afb869..558e0d14e0 100644 --- a/Telegram/SourceFiles/window/window_title_qt.cpp +++ b/Telegram/SourceFiles/window/window_title_qt.cpp @@ -351,29 +351,33 @@ QMargins TitleWidgetQt::resizeArea() const { } Qt::Edges TitleWidgetQt::edgesFromPos(const QPoint &pos) const { - if (pos.x() <= resizeArea().left()) { - if (pos.y() <= resizeArea().top()) { + const auto area = resizeArea(); + + if (area.isNull()) { + return Qt::Edges(); + } else if (pos.x() <= area.left()) { + if (pos.y() <= area.top()) { return Qt::LeftEdge | Qt::TopEdge; - } else if (pos.y() >= (window()->height() - resizeArea().bottom())) { + } else if (pos.y() >= (window()->height() - area.bottom())) { return Qt::LeftEdge | Qt::BottomEdge; } return Qt::LeftEdge; - } else if (pos.x() >= (window()->width() - resizeArea().right())) { - if (pos.y() <= resizeArea().top()) { + } else if (pos.x() >= (window()->width() - area.right())) { + if (pos.y() <= area.top()) { return Qt::RightEdge | Qt::TopEdge; - } else if (pos.y() >= (window()->height() - resizeArea().bottom())) { + } else if (pos.y() >= (window()->height() - area.bottom())) { return Qt::RightEdge | Qt::BottomEdge; } return Qt::RightEdge; - } else if (pos.y() <= resizeArea().top()) { + } else if (pos.y() <= area.top()) { return Qt::TopEdge; - } else if (pos.y() >= (window()->height() - resizeArea().bottom())) { + } else if (pos.y() >= (window()->height() - area.bottom())) { return Qt::BottomEdge; - } else { - return Qt::Edges(); } + + return Qt::Edges(); } void TitleWidgetQt::updateCursor(Qt::Edges edges) { -- cgit v1.2.3