Cocoa: Close ToolTips on parent window move.

Treat Qt::ToolTip windows the same way as Qt::Popup
windows: The parent window keeps track visible
transient child windows of this type and closes
them when appropriate.

This improves the locator popup window behavior in
Qt Creator: It now closes when moving the main Qt
Creator window.

Change-Id: Ibc5d0713469b7c9aba2fd13fb1eb559706c8c4ed
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-03-25 14:56:09 +01:00 committed by The Qt Project
parent 66178447e9
commit acebf67712

View File

@ -619,11 +619,13 @@ void QCocoaWindow::setVisible(bool visible)
// update the window geometry if there is a parent. // update the window geometry if there is a parent.
setGeometry(window()->geometry()); setGeometry(window()->geometry());
// Register popup windows so that the parent window can // Register popup windows so that the parent window can close them when needed.
// close them when needed. if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) {
if (window()->type() == Qt::Popup) {
// qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup); // qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup);
parentCocoaWindow->m_activePopupWindow = window(); parentCocoaWindow->m_activePopupWindow = window();
}
if (window()->type() == Qt::Popup) {
// QTBUG-30266: a window should not be resizable while a transient popup is open // QTBUG-30266: a window should not be resizable while a transient popup is open
// Since this isn't a native popup, the window manager doesn't close the popup when you click outside // Since this isn't a native popup, the window manager doesn't close the popup when you click outside
NSUInteger parentStyleMask = [parentCocoaWindow->m_nsWindow styleMask]; NSUInteger parentStyleMask = [parentCocoaWindow->m_nsWindow styleMask];