mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
Update dialog_savedgame.py
This commit is contained in:
parent
08a051ead9
commit
e45d650697
@ -183,6 +183,16 @@ class IMGWidget(QLabel):
|
|||||||
|
|
||||||
self.pix = pixmap
|
self.pix = pixmap
|
||||||
|
|
||||||
|
pixmap = QPixmap(self.size())
|
||||||
|
pixmap.fill(Qt.transparent)
|
||||||
|
painter = QPainter(pixmap)
|
||||||
|
painter.setRenderHint(QPainter.SmoothPixmapTransform)
|
||||||
|
painter.setRenderHint(QPainter.Antialiasing)
|
||||||
|
painter.drawPixmap(self.getrect(), self.pix)
|
||||||
|
painter.end()
|
||||||
|
|
||||||
|
self.setPixmap(pixmap)
|
||||||
|
self.setFixedSize(pixmap.size())
|
||||||
def getrect(self):
|
def getrect(self):
|
||||||
size = self.adaptsize(self.pix.size())
|
size = self.adaptsize(self.pix.size())
|
||||||
rect = QRect()
|
rect = QRect()
|
||||||
@ -191,22 +201,10 @@ class IMGWidget(QLabel):
|
|||||||
rect.setSize(size)
|
rect.setSize(size)
|
||||||
return rect
|
return rect
|
||||||
|
|
||||||
def paintEvent(self, a0) -> None:
|
|
||||||
if self.pix:
|
|
||||||
try:
|
|
||||||
painter = QPainter(self)
|
|
||||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
|
||||||
painter.setRenderHint(QPainter.HighQualityAntialiasing, True)
|
|
||||||
painter.setRenderHint(QPainter.LosslessImageRendering, True)
|
|
||||||
painter.drawPixmap(self.getrect(), self.pix)
|
|
||||||
except:
|
|
||||||
print_exc()
|
|
||||||
return super().paintEvent(a0)
|
|
||||||
|
|
||||||
def __init__(self, w, h, pixmap) -> None:
|
def __init__(self, w, h, pixmap) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setFixedSize(QSize(w, h))
|
self.setFixedSize(QSize(w, h))
|
||||||
self.pix = None
|
self.setScaledContents(True)
|
||||||
self.setimg(pixmap)
|
self.setimg(pixmap)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user