Support WindowTitleHint and FramelessWindowHint in QWasmWindow
WindowTitleHint now correctly enables/disables the window title, and FramelessWindowHint correctly enables/disables the window frame. Change-Id: I6f98f0a53af828606748308c6b5bd5d492cef9d2 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
916008a50d
commit
40ddc38a7b
@ -39,7 +39,7 @@ const char *Style = R"css(
|
|||||||
box-shadow: rgb(0 0 0 / 20%) 0px 10px 16px 0px, rgb(0 0 0 / 19%) 0px 6px 20px 0px;
|
box-shadow: rgb(0 0 0 / 20%) 0px 10px 16px 0px, rgb(0 0 0 / 19%) 0px 6px 20px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qt-window.has-title-bar {
|
.qt-window.has-frame {
|
||||||
border: var(--border-width) solid lightgray;
|
border: var(--border-width) solid lightgray;
|
||||||
caret-color: transparent;
|
caret-color: transparent;
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ const char *Style = R"css(
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qt-window.has-title-bar:not(.maximized) .resize-outline {
|
.qt-window.has-frame:not(.maximized) .resize-outline {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,17 +125,23 @@ const char *Style = R"css(
|
|||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qt-window.has-title-bar .title-bar {
|
.qt-window.has-frame .title-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-bar .window-name {
|
.title-bar .window-name {
|
||||||
|
display: none;
|
||||||
font-family: 'Lucida Grande';
|
font-family: 'Lucida Grande';
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.qt-window.has-title .title-bar .window-name {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.title-bar .spacer {
|
.title-bar .spacer {
|
||||||
flex-grow: 1
|
flex-grow: 1
|
||||||
}
|
}
|
||||||
|
@ -358,8 +358,9 @@ void QWasmWindow::onActivationChanged(bool active)
|
|||||||
void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
|
void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||||
{
|
{
|
||||||
m_flags = flags;
|
m_flags = flags;
|
||||||
dom::syncCSSClassWith(m_qtWindow, "has-title-bar", hasTitleBar());
|
dom::syncCSSClassWith(m_qtWindow, "has-frame", hasFrame());
|
||||||
dom::syncCSSClassWith(m_qtWindow, "has-shadow", !flags.testFlag(Qt::NoDropShadowWindowHint));
|
dom::syncCSSClassWith(m_qtWindow, "has-shadow", !flags.testFlag(Qt::NoDropShadowWindowHint));
|
||||||
|
dom::syncCSSClassWith(m_qtWindow, "has-title", flags.testFlag(Qt::WindowTitleHint));
|
||||||
dom::syncCSSClassWith(m_qtWindow, "transparent-for-input",
|
dom::syncCSSClassWith(m_qtWindow, "transparent-for-input",
|
||||||
flags.testFlag(Qt::WindowTransparentForInput));
|
flags.testFlag(Qt::WindowTransparentForInput));
|
||||||
|
|
||||||
@ -421,7 +422,7 @@ void QWasmWindow::applyWindowState()
|
|||||||
else
|
else
|
||||||
newGeom = normalGeometry();
|
newGeom = normalGeometry();
|
||||||
|
|
||||||
dom::syncCSSClassWith(m_qtWindow, "has-title-bar", hasTitleBar());
|
dom::syncCSSClassWith(m_qtWindow, "has-frame", hasFrame());
|
||||||
dom::syncCSSClassWith(m_qtWindow, "maximized", isMaximized);
|
dom::syncCSSClassWith(m_qtWindow, "maximized", isMaximized);
|
||||||
|
|
||||||
m_nonClientArea->titleBar()->setRestoreVisible(isMaximized);
|
m_nonClientArea->titleBar()->setRestoreVisible(isMaximized);
|
||||||
@ -518,9 +519,9 @@ void QWasmWindow::requestUpdate()
|
|||||||
m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery);
|
m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWasmWindow::hasTitleBar() const
|
bool QWasmWindow::hasFrame() const
|
||||||
{
|
{
|
||||||
return !m_state.testFlag(Qt::WindowFullScreen) && m_flags.testFlag(Qt::WindowTitleHint)
|
return !m_state.testFlag(Qt::WindowFullScreen) && !m_flags.testFlag(Qt::FramelessWindowHint)
|
||||||
&& !windowIsPopupType(m_flags);
|
&& !windowIsPopupType(m_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ private:
|
|||||||
friend class QWasmScreen;
|
friend class QWasmScreen;
|
||||||
|
|
||||||
void invalidate();
|
void invalidate();
|
||||||
bool hasTitleBar() const;
|
bool hasFrame() const;
|
||||||
bool hasMaximizeButton() const;
|
bool hasMaximizeButton() const;
|
||||||
void applyWindowState();
|
void applyWindowState();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user