qtquick|MDI: Improvements for resizing

This commit is contained in:
Sergio Martins
2021-03-03 15:21:22 +00:00
parent 9ce50fa305
commit c81ca45e41
2 changed files with 11 additions and 0 deletions

View File

@@ -119,6 +119,7 @@ bool WidgetResizeHandler::eventFilter(QObject *o, QEvent *e)
case QEvent::MouseButtonPress: {
if (mTarget->isMaximized())
break;
auto mouseEvent = static_cast<QMouseEvent *>(e);
auto cursorPos = cursorPosition(Qt5Qt6Compat::eventGlobalPos(mouseEvent));
updateCursor(cursorPos);
@@ -503,6 +504,14 @@ CursorPosition WidgetResizeHandler::cursorPosition(QPoint globalPos) const
if (!mTarget)
return CursorPosition_Undefined;
#ifdef KDDOCKWIDGETS_QTQUICK
if (isMDI()) {
// Special case for QtQuick. The MouseAreas are driving it and know better what's the
// cursor position
return CursorPosition(mTarget->property("cursorPosition").toInt());
}
#endif
QPoint pos = mTarget->mapFromGlobal(globalPos);
const int x = pos.x();

View File

@@ -77,7 +77,9 @@ public:
return false;
// Finally send the event
m_eventTarget->setProperty("cursorPosition", m_eventSource->property("cursorPosition"));
qApp->sendEvent(m_eventTarget, me);
m_eventTarget->setProperty("cursorPosition", CursorPosition_Undefined);
return false;
}