Add Qt::NoTitleBarBackgroundHint window flag
The flag requests that the window's title bar is drawn without a background color. This flag is useful in combination with the Qt::ExpandedClientAreaHint flag, to give the perception that the window's client area seamlessly blends with the titlebar area and controls. Task-number: QTBUG-127634 Change-Id: I1194630d737ae03324f79d2babd7ea3d8fca3d5b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
ebb2658242
commit
a1e6fed449
@ -240,6 +240,7 @@ namespace Qt {
|
|||||||
"Use Qt::ExpandedClientAreaHint instead") = 0x00400000,
|
"Use Qt::ExpandedClientAreaHint instead") = 0x00400000,
|
||||||
#endif
|
#endif
|
||||||
ExpandedClientAreaHint = 0x00400000,
|
ExpandedClientAreaHint = 0x00400000,
|
||||||
|
NoTitleBarBackgroundHint = 0x00800000,
|
||||||
|
|
||||||
CustomizeWindowHint = 0x02000000,
|
CustomizeWindowHint = 0x02000000,
|
||||||
WindowStaysOnBottomHint = 0x04000000,
|
WindowStaysOnBottomHint = 0x04000000,
|
||||||
|
@ -2353,6 +2353,11 @@
|
|||||||
window's \l{QWindow::safeAreaMargins()}{safe area margins} will reflect any
|
window's \l{QWindow::safeAreaMargins()}{safe area margins} will reflect any
|
||||||
areas that may have conflicting UI elements.
|
areas that may have conflicting UI elements.
|
||||||
|
|
||||||
|
\value [since 6.9] NoTitleBarBackgroundHint Requests that the window's title bar is drawn
|
||||||
|
without a background color. This flag is useful in combination with
|
||||||
|
Qt::ExpandedClientAreaHint, to give the perception that the window's
|
||||||
|
client area seamlessly blends with the titlebar area and controls.
|
||||||
|
|
||||||
\value WindowType_Mask A mask for extracting the window type
|
\value WindowType_Mask A mask for extracting the window type
|
||||||
part of the window flags.
|
part of the window flags.
|
||||||
|
|
||||||
|
@ -744,6 +744,9 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
|
|||||||
bool ignoreMouse = flags & Qt::WindowTransparentForInput;
|
bool ignoreMouse = flags & Qt::WindowTransparentForInput;
|
||||||
if (m_view.window.ignoresMouseEvents != ignoreMouse)
|
if (m_view.window.ignoresMouseEvents != ignoreMouse)
|
||||||
m_view.window.ignoresMouseEvents = ignoreMouse;
|
m_view.window.ignoresMouseEvents = ignoreMouse;
|
||||||
|
|
||||||
|
m_view.window.titlebarAppearsTransparent = (flags & Qt::NoTitleBarBackgroundHint)
|
||||||
|
|| (m_view.window.styleMask & QT_IGNORE_DEPRECATIONS(NSWindowStyleMaskTexturedBackground));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------- Window state -----------------------
|
// ----------------------- Window state -----------------------
|
||||||
@ -2034,7 +2037,6 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
|
|||||||
if (!m_drawContentBorderGradient) {
|
if (!m_drawContentBorderGradient) {
|
||||||
window.styleMask = window.styleMask & ~NSWindowStyleMaskTexturedBackground;
|
window.styleMask = window.styleMask & ~NSWindowStyleMaskTexturedBackground;
|
||||||
[window.contentView.superview setNeedsDisplay:YES];
|
[window.contentView.superview setNeedsDisplay:YES];
|
||||||
window.titlebarAppearsTransparent = NO;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2059,7 +2061,6 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
|
|||||||
int effectiveBottomContentBorderThickness = 0;
|
int effectiveBottomContentBorderThickness = 0;
|
||||||
|
|
||||||
[window setStyleMask:[window styleMask] | NSWindowStyleMaskTexturedBackground];
|
[window setStyleMask:[window styleMask] | NSWindowStyleMaskTexturedBackground];
|
||||||
window.titlebarAppearsTransparent = YES;
|
|
||||||
|
|
||||||
// Setting titlebarAppearsTransparent to YES means that the border thickness has to account
|
// Setting titlebarAppearsTransparent to YES means that the border thickness has to account
|
||||||
// for the title bar height as well, otherwise sheets will not be presented at the correct
|
// for the title bar height as well, otherwise sheets will not be presented at the correct
|
||||||
|
@ -33,6 +33,7 @@ HintControl::HintControl(QWidget *parent)
|
|||||||
, transparentForInputCheckBox(new QCheckBox(tr("Transparent for input")))
|
, transparentForInputCheckBox(new QCheckBox(tr("Transparent for input")))
|
||||||
, noDropShadowCheckBox(new QCheckBox(tr("No drop shadow")))
|
, noDropShadowCheckBox(new QCheckBox(tr("No drop shadow")))
|
||||||
, expandedClientAreaCheckBox(new QCheckBox(tr("Expanded client area")))
|
, expandedClientAreaCheckBox(new QCheckBox(tr("Expanded client area")))
|
||||||
|
, noTitleBarBackgroundCheckBox(new QCheckBox(tr("No titlebar background")))
|
||||||
{
|
{
|
||||||
connect(msWindowsFixedSizeDialogCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
connect(msWindowsFixedSizeDialogCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
connect(x11BypassWindowManagerCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
connect(x11BypassWindowManagerCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
@ -51,6 +52,7 @@ HintControl::HintControl(QWidget *parent)
|
|||||||
connect(transparentForInputCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
connect(transparentForInputCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
connect(noDropShadowCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
connect(noDropShadowCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
connect(expandedClientAreaCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
connect(expandedClientAreaCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
|
connect(noTitleBarBackgroundCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
|
||||||
|
|
||||||
auto *layout = new QHBoxLayout(this);
|
auto *layout = new QHBoxLayout(this);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
@ -70,6 +72,7 @@ HintControl::HintControl(QWidget *parent)
|
|||||||
basicHintsLayout->addWidget(msWindowsFixedSizeDialogCheckBox);
|
basicHintsLayout->addWidget(msWindowsFixedSizeDialogCheckBox);
|
||||||
basicHintsLayout->addWidget(x11BypassWindowManagerCheckBox);
|
basicHintsLayout->addWidget(x11BypassWindowManagerCheckBox);
|
||||||
basicHintsLayout->addWidget(expandedClientAreaCheckBox);
|
basicHintsLayout->addWidget(expandedClientAreaCheckBox);
|
||||||
|
basicHintsLayout->addWidget(noTitleBarBackgroundCheckBox);
|
||||||
layout->addLayout(basicHintsLayout);
|
layout->addLayout(basicHintsLayout);
|
||||||
|
|
||||||
customizeWindowGroup->setCheckable(true);
|
customizeWindowGroup->setCheckable(true);
|
||||||
@ -128,6 +131,8 @@ Qt::WindowFlags HintControl::hints() const
|
|||||||
flags |= Qt::NoDropShadowWindowHint;
|
flags |= Qt::NoDropShadowWindowHint;
|
||||||
if (expandedClientAreaCheckBox->isChecked())
|
if (expandedClientAreaCheckBox->isChecked())
|
||||||
flags |= Qt::ExpandedClientAreaHint;
|
flags |= Qt::ExpandedClientAreaHint;
|
||||||
|
if (noTitleBarBackgroundCheckBox->isChecked())
|
||||||
|
flags |= Qt::NoTitleBarBackgroundHint;
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +155,7 @@ void HintControl::setHints(Qt::WindowFlags flags)
|
|||||||
transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput);
|
transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput);
|
||||||
noDropShadowCheckBox->setChecked(flags & Qt::NoDropShadowWindowHint);
|
noDropShadowCheckBox->setChecked(flags & Qt::NoDropShadowWindowHint);
|
||||||
expandedClientAreaCheckBox->setChecked(flags & Qt::ExpandedClientAreaHint);
|
expandedClientAreaCheckBox->setChecked(flags & Qt::ExpandedClientAreaHint);
|
||||||
|
noTitleBarBackgroundCheckBox->setChecked(flags & Qt::NoTitleBarBackgroundHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HintControl::slotCheckBoxChanged()
|
void HintControl::slotCheckBoxChanged()
|
||||||
|
@ -48,6 +48,7 @@ private:
|
|||||||
QCheckBox *transparentForInputCheckBox;
|
QCheckBox *transparentForInputCheckBox;
|
||||||
QCheckBox *noDropShadowCheckBox;
|
QCheckBox *noDropShadowCheckBox;
|
||||||
QCheckBox *expandedClientAreaCheckBox;
|
QCheckBox *expandedClientAreaCheckBox;
|
||||||
|
QCheckBox *noTitleBarBackgroundCheckBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Control for the Qt::WindowState enum, optional with a "visible" QCheckbox
|
// Control for the Qt::WindowState enum, optional with a "visible" QCheckbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user