summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2021-02-17 22:04:52 +0400
committerJohn Preston <johnprestonmail@gmail.com>2021-02-19 12:37:14 +0400
commita9c08552c898f611599126d431fb092934a82fd4 (patch)
tree1f23e819b90e3e51b454a2979a5dd56214c06819
parentb3660f1ed882450c9ac6527ebe08f7c10d9b2c9f (diff)
Check if resize area is null
-rw-r--r--Telegram/SourceFiles/window/window_title_qt.cpp24
1 files 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) {