Don't change cursor in fixed-size windows.
This commit is contained in:
parent
2b36c36dcb
commit
b486260559
1 changed files with 17 additions and 9 deletions
|
|
@ -239,28 +239,36 @@ QMargins DefaultWindowHelper::resizeArea() const {
|
||||||
|
|
||||||
Qt::Edges DefaultWindowHelper::edgesFromPos(const QPoint &pos) const {
|
Qt::Edges DefaultWindowHelper::edgesFromPos(const QPoint &pos) const {
|
||||||
const auto area = resizeArea();
|
const auto area = resizeArea();
|
||||||
|
const auto ignoreHorizontal = (window()->minimumWidth()
|
||||||
|
== window()->maximumWidth());
|
||||||
|
const auto ignoreVertical = (window()->minimumHeight()
|
||||||
|
== window()->maximumHeight());
|
||||||
|
|
||||||
if (area.isNull()) {
|
if (area.isNull()) {
|
||||||
return Qt::Edges();
|
return Qt::Edges();
|
||||||
} else if (pos.x() <= area.left()) {
|
} else if (!ignoreHorizontal && pos.x() <= area.left()) {
|
||||||
if (pos.y() <= area.top()) {
|
if (!ignoreVertical && pos.y() <= area.top()) {
|
||||||
return Qt::LeftEdge | Qt::TopEdge;
|
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 | Qt::BottomEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Qt::LeftEdge;
|
return Qt::LeftEdge;
|
||||||
} else if (pos.x() >= (window()->width() - area.right())) {
|
} else if (!ignoreHorizontal
|
||||||
if (pos.y() <= area.top()) {
|
&& pos.x() >= (window()->width() - area.right())) {
|
||||||
|
if (!ignoreVertical && pos.y() <= area.top()) {
|
||||||
return Qt::RightEdge | Qt::TopEdge;
|
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 | Qt::BottomEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Qt::RightEdge;
|
return Qt::RightEdge;
|
||||||
} else if (pos.y() <= area.top()) {
|
} else if (!ignoreVertical && pos.y() <= area.top()) {
|
||||||
return Qt::TopEdge;
|
return Qt::TopEdge;
|
||||||
} else if (pos.y() >= (window()->height() - area.bottom())) {
|
} else if (!ignoreVertical
|
||||||
|
&& pos.y() >= (window()->height() - area.bottom())) {
|
||||||
return Qt::BottomEdge;
|
return Qt::BottomEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,7 +397,7 @@ void DefaultWindowHelper::updateCursor(Qt::Edges edges) {
|
||||||
} else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) {
|
} else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) {
|
||||||
window()->setCursor(QCursor(Qt::SizeVerCursor));
|
window()->setCursor(QCursor(Qt::SizeVerCursor));
|
||||||
} else {
|
} else {
|
||||||
window()->unsetCursor();
|
window()->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue