This commit is contained in:
恍兮惚兮 2024-09-13 09:57:32 +08:00
parent 03131f86b3
commit 1f789f8b16
2 changed files with 5 additions and 2 deletions

View File

@ -17,10 +17,12 @@ class CachedQGraphicsDropShadowEffect_multi(QGraphicsDropShadowEffect):
super().__init__(parent) super().__init__(parent)
self.shadow_pixmap = QPixmap() self.shadow_pixmap = QPixmap()
self.x = x self.x = x
self.savey = None
def draw(self, painter): def draw(self, painter):
r = self.parent().devicePixelRatioF() r = self.parent().devicePixelRatioF()
if self.shadow_pixmap.isNull(): if self.shadow_pixmap.isNull() or self.savey != self.parent().y():
size = QSize(painter.device().width(), painter.device().height()) * r size = QSize(painter.device().width(), painter.device().height()) * r
self.shadow_pixmap = QPixmap(size) self.shadow_pixmap = QPixmap(size)
self.shadow_pixmap.setDevicePixelRatio(r) self.shadow_pixmap.setDevicePixelRatio(r)
@ -29,6 +31,7 @@ class CachedQGraphicsDropShadowEffect_multi(QGraphicsDropShadowEffect):
shadow_painter.setRenderHint(QPainter.RenderHint.Antialiasing) shadow_painter.setRenderHint(QPainter.RenderHint.Antialiasing)
for _ in range(self.x): for _ in range(self.x):
super().draw(shadow_painter) super().draw(shadow_painter)
self.savey = self.parent().y()
painter.setRenderHint(QPainter.RenderHint.Antialiasing) painter.setRenderHint(QPainter.RenderHint.Antialiasing)
painter.drawPixmap( painter.drawPixmap(
-int(self.parent().x()), -int(self.parent().x()),

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5) set(VERSION_MAJOR 5)
set(VERSION_MINOR 35) set(VERSION_MINOR 35)
set(VERSION_PATCH 0) set(VERSION_PATCH 1)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)