Cocoa integration - inconsistent window types/styles
NSWindow does not support 'utility window' style, but NSPanel - does. If we first create a normal widget, then later make it a Qt::Tool, we still have NSWindow with (now) invalid 'floating panel' window level (but no 'utility window' style) - it's a window that stays on top even when we switch to a different application. Change-Id: I691bc6f681cdf8bc2a9637444da33e7e6200ee2f Task-number: QTBUG-45938 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
59956ec905
commit
aed7540d45
@ -275,6 +275,7 @@ protected:
|
|||||||
void syncWindowState(Qt::WindowState newState);
|
void syncWindowState(Qt::WindowState newState);
|
||||||
void reinsertChildWindow(QCocoaWindow *child);
|
void reinsertChildWindow(QCocoaWindow *child);
|
||||||
void removeChildWindow(QCocoaWindow *child);
|
void removeChildWindow(QCocoaWindow *child);
|
||||||
|
bool isNativeWindowTypeInconsistent();
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
public: // for QNSView
|
public: // for QNSView
|
||||||
|
@ -652,7 +652,7 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
// We need to recreate if the modality has changed as the style mask will need updating
|
// We need to recreate if the modality has changed as the style mask will need updating
|
||||||
if (m_windowModality != window()->modality())
|
if (m_windowModality != window()->modality() || isNativeWindowTypeInconsistent())
|
||||||
recreateWindow(parent());
|
recreateWindow(parent());
|
||||||
|
|
||||||
// Register popup windows. The Cocoa platform plugin will forward mouse events
|
// Register popup windows. The Cocoa platform plugin will forward mouse events
|
||||||
@ -1531,6 +1531,17 @@ void QCocoaWindow::removeChildWindow(QCocoaWindow *child)
|
|||||||
[m_nsWindow removeChildWindow:child->m_nsWindow];
|
[m_nsWindow removeChildWindow:child->m_nsWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QCocoaWindow::isNativeWindowTypeInconsistent()
|
||||||
|
{
|
||||||
|
if (!m_nsWindow)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const bool isPanel = [m_nsWindow isKindOfClass:[QNSPanel class]];
|
||||||
|
const bool usePanel = shouldUseNSPanel();
|
||||||
|
|
||||||
|
return isPanel != usePanel;
|
||||||
|
}
|
||||||
|
|
||||||
void QCocoaWindow::removeMonitor()
|
void QCocoaWindow::removeMonitor()
|
||||||
{
|
{
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user