qtquick|MDI: Fix resizing inner MDI dock widgets

It was flaky. The mouse move events came from global event filter
but the mouse press came from the Frame's mouse area. Sometimes the
QQuickWindow wouldn't deliver the press to the frame if it was done
outside, while the moves were changing the cursor shape since
we had a treshold

Now we guarantee that whenever the cursor changes the resize
will really happen
This commit is contained in:
Sergio Martins
2021-03-02 14:38:40 +00:00
parent 16b0770d72
commit cb2ffe66af
2 changed files with 138 additions and 3 deletions

View File

@@ -104,9 +104,7 @@ bool WidgetResizeHandler::eventFilter(QObject *o, QEvent *e)
}
if (!widget) {
auto qquickWindow = qobject_cast<QQuickWindow*>(o);
if (!(qquickWindow && e->type() == QEvent::MouseMove))
return false;
return false;
}
}
@@ -118,6 +116,7 @@ bool WidgetResizeHandler::eventFilter(QObject *o, QEvent *e)
break;
auto mouseEvent = static_cast<QMouseEvent *>(e);
auto cursorPos = cursorPosition(Qt5Qt6Compat::eventGlobalPos(mouseEvent));
updateCursor(cursorPos);
if (cursorPos == CursorPosition_Undefined)
return false;
@@ -135,6 +134,7 @@ bool WidgetResizeHandler::eventFilter(QObject *o, QEvent *e)
}
case QEvent::MouseButtonRelease: {
m_resizingInProgress = false;
updateCursor(CursorPosition_Undefined);
auto mouseEvent = static_cast<QMouseEvent *>(e);
if (mTarget->isMaximized() || !m_resizingInProgress || mouseEvent->button() != Qt::LeftButton)