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 {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue