fix unwanted cursor change when leave edge region (#80)

This commit is contained in:
Altair Wei 2021-08-23 09:29:50 +08:00 committed by GitHub
parent 523e35fdb1
commit 01dd43c356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>518</width>
<height>362</height>
<height>368</height>
</rect>
</property>
<property name="windowTitle">
@ -152,6 +152,13 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;a href=&quot;https://www.google.com&quot;&gt;https://www.google.com&lt;/a&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">

View File

@ -158,19 +158,27 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
}
} else if (type == QEvent::MouseMove) {
// Display resize indicators
static bool cursorChanged = false;
if ((window->windowState() == Qt::WindowState::WindowNoState) && resizable) {
if (((edges & Qt::TopEdge) && (edges & Qt::LeftEdge))
|| ((edges & Qt::BottomEdge) && (edges & Qt::RightEdge))) {
window->setCursor(Qt::SizeFDiagCursor);
cursorChanged = true;
} else if (((edges & Qt::TopEdge) && (edges & Qt::RightEdge))
|| ((edges & Qt::BottomEdge) && (edges & Qt::LeftEdge))) {
window->setCursor(Qt::SizeBDiagCursor);
cursorChanged = true;
} else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) {
window->setCursor(Qt::SizeVerCursor);
cursorChanged = true;
} else if ((edges & Qt::LeftEdge) || (edges & Qt::RightEdge)) {
window->setCursor(Qt::SizeHorCursor);
cursorChanged = true;
} else {
window->setCursor(Qt::ArrowCursor);
if (cursorChanged) {
window->setCursor(Qt::ArrowCursor);
cursorChanged = false;
}
}
}