windowflags: Add control to toggle Qt::NoDropShadowWindowHint

Change-Id: I53b496c7b27a73cfb6052af3cd8643a971609523
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-09-19 20:09:04 +02:00
parent 6fc751aedf
commit 8e577b6d10
2 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,7 @@ HintControl::HintControl(QWidget *parent)
, windowStaysOnBottomCheckBox(new QCheckBox(tr("Window stays on bottom")))
, customizeWindowHintCheckBox(new QCheckBox(tr("Customize window")))
, transparentForInputCheckBox(new QCheckBox(tr("Transparent for input")))
, noDropShadowCheckBox(new QCheckBox(tr("No drop shadow")))
{
connect(msWindowsFixedSizeDialogCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(x11BypassWindowManagerCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
@ -45,6 +46,7 @@ HintControl::HintControl(QWidget *parent)
connect(windowStaysOnBottomCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(customizeWindowHintCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(transparentForInputCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(noDropShadowCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
@ -64,6 +66,7 @@ HintControl::HintControl(QWidget *parent)
layout->addWidget(windowStaysOnBottomCheckBox, 7, 1);
layout->addWidget(customizeWindowHintCheckBox, 5, 0);
layout->addWidget(transparentForInputCheckBox, 6, 0);
layout->addWidget(noDropShadowCheckBox, 7, 0);
}
Qt::WindowFlags HintControl::hints() const
@ -99,6 +102,8 @@ Qt::WindowFlags HintControl::hints() const
flags |= Qt::CustomizeWindowHint;
if (transparentForInputCheckBox->isChecked())
flags |= Qt::WindowTransparentForInput;
if (noDropShadowCheckBox->isChecked())
flags |= Qt::NoDropShadowWindowHint;
return flags;
}
@ -119,6 +124,7 @@ void HintControl::setHints(Qt::WindowFlags flags)
windowStaysOnBottomCheckBox->setChecked(flags & Qt::WindowStaysOnBottomHint);
customizeWindowHintCheckBox->setChecked(flags & Qt::CustomizeWindowHint);
transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput);
noDropShadowCheckBox->setChecked(flags & Qt::NoDropShadowWindowHint);
}
void HintControl::slotCheckBoxChanged()

View File

@ -46,6 +46,7 @@ private:
QCheckBox *windowStaysOnBottomCheckBox;
QCheckBox *customizeWindowHintCheckBox;
QCheckBox *transparentForInputCheckBox;
QCheckBox *noDropShadowCheckBox;
};
// Control for the Qt::WindowState enum, optional with a "visible" QCheckbox