Adjust behavior of windowIsPopupType and hasTitleBar

The previous implementation did not check for the popup flag, so
it was added, and the tool window exception was preserved.
hasTitleBar was also changed so it checks for popups and not tooltips
specifically (tooltips are always popups).

Change-Id: I3e2ba3be56e992b30ca2a07375092073572e7fcb
Pick-to: 6.2
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
David Skoland 2021-10-26 13:32:48 +02:00
parent ea3ede9c45
commit aa6405ee03
2 changed files with 8 additions and 9 deletions

View File

@ -407,20 +407,19 @@ void QWasmWindow::requestUpdate()
bool QWasmWindow::hasTitleBar() const
{
auto flags = window()->flags();
Qt::WindowFlags flags = window()->flags();
return !(m_windowState & Qt::WindowFullScreen)
&& flags.testFlag(Qt::WindowTitleHint)
&& !flags.testFlag(Qt::ToolTip)
&& !(windowIsPopupType(flags))
&& m_needsCompositor;
}
bool QWasmWindow::windowIsPopupType(Qt::WindowType type) const
bool QWasmWindow::windowIsPopupType(Qt::WindowFlags flags) const
{
if (type == Qt::Widget)
type = window()->type();
if (type != Qt::Tool)
return true;
return false;
if (flags.testFlag(Qt::Tool))
return false; // Qt::Tool has the Popup bit set but isn't
return (flags.testFlag(Qt::Popup));
}
void QWasmWindow::requestActivateWindow()

View File

@ -124,7 +124,7 @@ protected:
bool m_needsCompositor = false;
friend class QWasmCompositor;
friend class QWasmEventTranslator;
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;
bool windowIsPopupType(Qt::WindowFlags flags) const;
};
QT_END_NAMESPACE
#endif // QWASMWINDOW_H