mirror of
https://github.com/crystalidea/qt-build-tools.git
synced 2024-11-22 19:00:04 +08:00
Apply patch for https://bugreports.qt.io/browse/QTBUG-52023 (https://codereview.qt-project.org/#/c/153745/)
This commit is contained in:
parent
e253ec906c
commit
354fa57d2b
@ -1638,8 +1638,12 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor)
|
||||
// Othervise, set the cursor if this window is under the mouse. In
|
||||
// this case QNSView::cursorUpdate will set the cursor as the pointer
|
||||
// moves.
|
||||
if (m_nsWindow && m_qtView) {
|
||||
[m_nsWindow invalidateCursorRectsForView : m_qtView];
|
||||
NSWindow *nsWindow = m_nsWindow;
|
||||
if (!nsWindow)
|
||||
nsWindow = [m_qtView nsWindow];
|
||||
|
||||
if (nsWindow && m_qtView) {
|
||||
[nsWindow invalidateCursorRectsForView : m_qtView];
|
||||
} else {
|
||||
if (m_windowUnderMouse)
|
||||
[cursor set];
|
||||
|
@ -140,6 +140,8 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
||||
- (void)registerDragTypes;
|
||||
- (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender;
|
||||
|
||||
- (NSWindow *)nsWindow;
|
||||
|
||||
@end
|
||||
|
||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
|
||||
|
@ -921,7 +921,7 @@ QT_WARNING_POP
|
||||
{
|
||||
Q_UNUSED(theEvent)
|
||||
// Set the cursor manually if there is no NSWindow.
|
||||
if (!m_platformWindow->m_nsWindow && m_platformWindow->m_windowCursor)
|
||||
if (![self nsWindow] && m_platformWindow->m_windowCursor)
|
||||
[m_platformWindow->m_windowCursor set];
|
||||
else
|
||||
[super cursorUpdate:theEvent];
|
||||
@ -930,7 +930,7 @@ QT_WARNING_POP
|
||||
-(void)resetCursorRects
|
||||
{
|
||||
// Use the cursor rect API if there is a NSWindow
|
||||
if (m_platformWindow->m_nsWindow && m_platformWindow->m_windowCursor)
|
||||
if ([self nsWindow] && m_platformWindow->m_windowCursor)
|
||||
[self addCursorRect:[self visibleRect] cursor:m_platformWindow->m_windowCursor];
|
||||
}
|
||||
|
||||
@ -2054,4 +2054,24 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
|
||||
QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons);
|
||||
}
|
||||
|
||||
- (NSWindow *)nsWindow
|
||||
{
|
||||
typedef QT_MANGLE_NAMESPACE(QNSView) QNSV;
|
||||
|
||||
NSWindow *win = m_platformWindow->m_nsWindow;
|
||||
NSView *parent = self.superview;
|
||||
while (!win) {
|
||||
if (![parent isKindOfClass:[QNSV class]])
|
||||
break;
|
||||
|
||||
QCocoaWindow *platformWindow = static_cast<QNSV *>(parent)->m_platformWindow;
|
||||
if (platformWindow)
|
||||
win = platformWindow->m_nsWindow;
|
||||
|
||||
parent = parent.superview;
|
||||
}
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user