diff options
author | Piotr Wierciński <[email protected]> | 2023-07-14 12:36:17 +0200 |
---|---|---|
committer | Piotr Wierciński <[email protected]> | 2023-07-20 11:20:47 +0200 |
commit | bd86ae3850f2f61c9fe43f61c4d0984df22618fb (patch) | |
tree | 30ff4ad93101472bda3d8e87bf1889c7fc3e11b8 | |
parent | 042a692c5746d79404895587242ccc0f766b4c56 (diff) |
wasm: Render Qt::SubWindow borderless
Windows with Qt::SubWindow flag should not have platform decoration.
Fixes: QTBUG-115054
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <[email protected]>
(cherry picked from commit 0493504f34c6673e05be630d8096cf2a78a780b1)
-rw-r--r-- | src/plugins/platforms/wasm/qwasmwindow.cpp | 19 | ||||
-rw-r--r-- | src/plugins/platforms/wasm/qwasmwindow.h | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index cbcc1733e18..11513fdd8b2 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -375,10 +375,10 @@ void QWasmWindow::onActivationChanged(bool active) void QWasmWindow::setWindowFlags(Qt::WindowFlags flags) { m_flags = flags; + dom::syncCSSClassWith(m_qtWindow, "frameless", !hasFrame()); dom::syncCSSClassWith(m_qtWindow, "has-border", hasBorder()); dom::syncCSSClassWith(m_qtWindow, "has-shadow", hasShadow()); - dom::syncCSSClassWith(m_qtWindow, "has-title", flags.testFlag(Qt::WindowTitleHint)); - dom::syncCSSClassWith(m_qtWindow, "frameless", flags.testFlag(Qt::FramelessWindowHint)); + dom::syncCSSClassWith(m_qtWindow, "has-title", hasTitleBar()); dom::syncCSSClassWith(m_qtWindow, "transparent-for-input", flags.testFlag(Qt::WindowTransparentForInput)); @@ -561,16 +561,25 @@ void QWasmWindow::requestUpdate() m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery); } +bool QWasmWindow::hasFrame() const +{ + return !m_flags.testFlag(Qt::FramelessWindowHint); +} + bool QWasmWindow::hasBorder() const { - return !m_state.testFlag(Qt::WindowFullScreen) && !m_flags.testFlag(Qt::FramelessWindowHint) + return hasFrame() && !m_state.testFlag(Qt::WindowFullScreen) && !m_flags.testFlag(Qt::SubWindow) && !windowIsPopupType(m_flags); } +bool QWasmWindow::hasTitleBar() const +{ + return hasBorder() && m_flags.testFlag(Qt::WindowTitleHint); +} + bool QWasmWindow::hasShadow() const { - return !m_flags.testFlag(Qt::NoDropShadowWindowHint) - && !m_flags.testFlag(Qt::FramelessWindowHint); + return hasBorder() && !m_flags.testFlag(Qt::NoDropShadowWindowHint); } bool QWasmWindow::hasMaximizeButton() const diff --git a/src/plugins/platforms/wasm/qwasmwindow.h b/src/plugins/platforms/wasm/qwasmwindow.h index f38b44d4e80..7db125f48e8 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.h +++ b/src/plugins/platforms/wasm/qwasmwindow.h @@ -97,6 +97,8 @@ private: static constexpr auto minSizeForRegularWindows = 100; void invalidate(); + bool hasFrame() const; + bool hasTitleBar() const; bool hasBorder() const; bool hasShadow() const; bool hasMaximizeButton() const; |