mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
better scaling method
This commit is contained in:
parent
a52c025816
commit
5c515096af
1 changed files with 6 additions and 12 deletions
|
|
@ -69,15 +69,12 @@ class LauncherSettingsLabel(QtWidgets.QWidget):
|
||||||
return cls._settings_icon
|
return cls._settings_icon
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
painter = QtGui.QPainter()
|
painter = QtGui.QPainter(self)
|
||||||
painter.begin(self)
|
|
||||||
|
|
||||||
render_hints = (
|
painter.setRenderHints(
|
||||||
QtGui.QPainter.Antialiasing
|
QtGui.QPainter.Antialiasing
|
||||||
| QtGui.QPainter.SmoothPixmapTransform
|
| QtGui.QPainter.SmoothPixmapTransform
|
||||||
)
|
)
|
||||||
if hasattr(QtGui.QPainter, "HighQualityAntialiasing"):
|
|
||||||
render_hints |= QtGui.QPainter.HighQualityAntialiasing
|
|
||||||
|
|
||||||
rect = event.rect()
|
rect = event.rect()
|
||||||
size = min(rect.height(), rect.width())
|
size = min(rect.height(), rect.width())
|
||||||
|
|
@ -85,14 +82,11 @@ class LauncherSettingsLabel(QtWidgets.QWidget):
|
||||||
rect.x(), rect.y(),
|
rect.x(), rect.y(),
|
||||||
size, size
|
size, size
|
||||||
)
|
)
|
||||||
pixmap = self._pixmap.scaled(
|
src_rect = QtCore.QRect(
|
||||||
pix_rect.size(),
|
0, 0,
|
||||||
QtCore.Qt.KeepAspectRatio,
|
self._pixmap.width(), self._pixmap.height()
|
||||||
QtCore.Qt.SmoothTransformation
|
|
||||||
|
|
||||||
)
|
)
|
||||||
painter.setRenderHints(render_hints)
|
painter.drawPixmap(pix_rect, self._pixmap, src_rect)
|
||||||
painter.drawPixmap(0, 0, pixmap)
|
|
||||||
|
|
||||||
painter.end()
|
painter.end()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue