forked from github_mirror/framelesshelper
improve titlebar move behavor (#74)
This commit is contained in:
parent
ebc8792630
commit
6acfdfdf61
|
@ -131,6 +131,16 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
|
||||||
&& (localMousePosition.x() < (windowWidth - resizeBorderWidth))
|
&& (localMousePosition.x() < (windowWidth - resizeBorderWidth))
|
||||||
&& !hitTestVisible;
|
&& !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 (type == QEvent::MouseButtonDblClick) {
|
||||||
if (mouseEvent->button() != Qt::MouseButton::LeftButton) {
|
if (mouseEvent->button() != Qt::MouseButton::LeftButton) {
|
||||||
return false;
|
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 (edges == Qt::Edges{}) {
|
||||||
if (isInTitlebarArea) {
|
if (isInTitlebarArea) {
|
||||||
if (!window->startSystemMove()) {
|
if (!window->startSystemMove()) {
|
||||||
|
|
Loading…
Reference in New Issue