Allow disabling window title shadow on Windows.
This commit is contained in:
parent
44161f183c
commit
4f2a33ea70
3 changed files with 17 additions and 2 deletions
|
|
@ -104,9 +104,20 @@ void TitleWidget::setText(const QString &text) {
|
|||
|
||||
void TitleWidget::setStyle(const style::WindowTitle &st) {
|
||||
_controls.setStyle(st);
|
||||
if (!st.shadow) {
|
||||
_shadow.destroy();
|
||||
} else if (!_shadow) {
|
||||
_shadow.create(this, st::titleShadow);
|
||||
updateShadowGeometry();
|
||||
}
|
||||
refreshGeometryWithWidth(window()->width());
|
||||
}
|
||||
|
||||
void TitleWidget::updateShadowGeometry() {
|
||||
const auto thickness = st::lineWidth;
|
||||
_shadow->setGeometry(0, height() - thickness, width(), thickness);
|
||||
}
|
||||
|
||||
void TitleWidget::refreshGeometryWithWidth(int width) {
|
||||
const auto add = additionalPadding();
|
||||
setGeometry(0, 0, width, _controls.st()->height + add);
|
||||
|
|
@ -136,8 +147,9 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void TitleWidget::resizeEvent(QResizeEvent *e) {
|
||||
const auto thickness = st::lineWidth;
|
||||
_shadow->setGeometry(0, height() - thickness, width(), thickness);
|
||||
if (_shadow) {
|
||||
updateShadowGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
HitTestResult TitleWidget::hitTest(
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ private:
|
|||
[[nodiscard]] bool additionalPaddingRequired() const;
|
||||
void refreshGeometryWithWidth(int width);
|
||||
void setAdditionalPadding(int padding);
|
||||
void updateShadowGeometry();
|
||||
|
||||
std::unique_ptr<PaddingHelper> _paddingHelper;
|
||||
TitleControls _controls;
|
||||
|
|
|
|||
|
|
@ -558,6 +558,7 @@ WindowTitle {
|
|||
bgActive: color;
|
||||
fg: color;
|
||||
fgActive: color;
|
||||
shadow: bool;
|
||||
style: TextStyle;
|
||||
minimize: IconButton;
|
||||
minimizeIconActive: icon;
|
||||
|
|
@ -1428,6 +1429,7 @@ defaultWindowTitle: WindowTitle {
|
|||
style: TextStyle(defaultTextStyle) {
|
||||
font: font(semibold 12px);
|
||||
}
|
||||
shadow: true;
|
||||
minimize: IconButton(windowTitleButton) {
|
||||
icon: icon {
|
||||
{ windowTitleButtonSize, titleButtonBg },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue