improve titlebar move behavor (#74)

This commit is contained in:
Altair Wei 2021-08-15 12:32:42 +08:00 committed by GitHub
parent ebc8792630
commit 6acfdfdf61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -131,6 +131,16 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
&& (localMousePosition.x() < (windowWidth - resizeBorderWidth))
&& !hitTestVisible;
}
// Determine if the mouse click occurred in the title bar
static bool titlebarClicked = false;
if (type == QEvent::MouseButtonPress) {
if (isInTitlebarArea)
titlebarClicked = true;
else
titlebarClicked = false;
}
if (type == QEvent::MouseButtonDblClick) {
if (mouseEvent->button() != Qt::MouseButton::LeftButton) {
return false;
@ -164,7 +174,7 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
}
}
if (mouseEvent->buttons() & Qt::LeftButton) {
if ((mouseEvent->buttons() & Qt::LeftButton) && titlebarClicked) {
if (edges == Qt::Edges{}) {
if (isInTitlebarArea) {
if (!window->startSystemMove()) {