Skip to content

Commit

Permalink
Merge pull request #207 from coolkiid/p/coolkiid/fix-paintEvent
Browse files Browse the repository at this point in the history
[bugfix] Fix profile_level_icon_widget paintEvent
  • Loading branch information
Zzaphkiel authored Jan 16, 2024
2 parents 72bfba9 + d5da6a5 commit db289ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ mymake.ps1
render.html

# 忽略日志文件
log
log

# 忽略虚拟环境
venv
seraphine
6 changes: 3 additions & 3 deletions app/components/profile_level_icon_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def paintEvent(self, event):
painter.setRenderHint(QPainter.Antialiasing)

scaledImage = self.image.scaled(
self.width() - self.sep,
self.height() - self.sep,
self.width() - int(self.sep),
self.height() - int(self.sep),
Qt.AspectRatioMode.KeepAspectRatioByExpanding)

clipPath = QPainterPath()
Expand All @@ -98,7 +98,7 @@ def paintEvent(self, event):
self.height() - self.sep)

painter.setClipPath(clipPath)
painter.drawImage(self.sep // 2, self.sep // 2, scaledImage)
painter.drawImage(int(self.sep // 2), int(self.sep // 2), scaledImage)

def updateIcon(self, icon: str, xpSinceLastLevel=None, xpUntilNextLevel=None, text=""):
self.image = QImage(icon)
Expand Down

0 comments on commit db289ac

Please sign in to comment.