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) {
|
void TitleWidget::setStyle(const style::WindowTitle &st) {
|
||||||
_controls.setStyle(st);
|
_controls.setStyle(st);
|
||||||
|
if (!st.shadow) {
|
||||||
|
_shadow.destroy();
|
||||||
|
} else if (!_shadow) {
|
||||||
|
_shadow.create(this, st::titleShadow);
|
||||||
|
updateShadowGeometry();
|
||||||
|
}
|
||||||
refreshGeometryWithWidth(window()->width());
|
refreshGeometryWithWidth(window()->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TitleWidget::updateShadowGeometry() {
|
||||||
|
const auto thickness = st::lineWidth;
|
||||||
|
_shadow->setGeometry(0, height() - thickness, width(), thickness);
|
||||||
|
}
|
||||||
|
|
||||||
void TitleWidget::refreshGeometryWithWidth(int width) {
|
void TitleWidget::refreshGeometryWithWidth(int width) {
|
||||||
const auto add = additionalPadding();
|
const auto add = additionalPadding();
|
||||||
setGeometry(0, 0, width, _controls.st()->height + add);
|
setGeometry(0, 0, width, _controls.st()->height + add);
|
||||||
|
|
@ -136,8 +147,9 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleWidget::resizeEvent(QResizeEvent *e) {
|
void TitleWidget::resizeEvent(QResizeEvent *e) {
|
||||||
const auto thickness = st::lineWidth;
|
if (_shadow) {
|
||||||
_shadow->setGeometry(0, height() - thickness, width(), thickness);
|
updateShadowGeometry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HitTestResult TitleWidget::hitTest(
|
HitTestResult TitleWidget::hitTest(
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ private:
|
||||||
[[nodiscard]] bool additionalPaddingRequired() const;
|
[[nodiscard]] bool additionalPaddingRequired() const;
|
||||||
void refreshGeometryWithWidth(int width);
|
void refreshGeometryWithWidth(int width);
|
||||||
void setAdditionalPadding(int padding);
|
void setAdditionalPadding(int padding);
|
||||||
|
void updateShadowGeometry();
|
||||||
|
|
||||||
std::unique_ptr<PaddingHelper> _paddingHelper;
|
std::unique_ptr<PaddingHelper> _paddingHelper;
|
||||||
TitleControls _controls;
|
TitleControls _controls;
|
||||||
|
|
|
||||||
|
|
@ -558,6 +558,7 @@ WindowTitle {
|
||||||
bgActive: color;
|
bgActive: color;
|
||||||
fg: color;
|
fg: color;
|
||||||
fgActive: color;
|
fgActive: color;
|
||||||
|
shadow: bool;
|
||||||
style: TextStyle;
|
style: TextStyle;
|
||||||
minimize: IconButton;
|
minimize: IconButton;
|
||||||
minimizeIconActive: icon;
|
minimizeIconActive: icon;
|
||||||
|
|
@ -1428,6 +1429,7 @@ defaultWindowTitle: WindowTitle {
|
||||||
style: TextStyle(defaultTextStyle) {
|
style: TextStyle(defaultTextStyle) {
|
||||||
font: font(semibold 12px);
|
font: font(semibold 12px);
|
||||||
}
|
}
|
||||||
|
shadow: true;
|
||||||
minimize: IconButton(windowTitleButton) {
|
minimize: IconButton(windowTitleButton) {
|
||||||
icon: icon {
|
icon: icon {
|
||||||
{ windowTitleButtonSize, titleButtonBg },
|
{ windowTitleButtonSize, titleButtonBg },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue