ListGameWidget: Fix progress label relocating randomly
This commit is contained in:
parent
7ef5172d62
commit
da2e1c0d27
|
@ -18,7 +18,7 @@ class ProgressLabel(QLabel):
|
|||
|
||||
def __center_on_parent(self):
|
||||
fm = QFontMetrics(self.font())
|
||||
rect = fm.boundingRect(f" {self.text()} ")
|
||||
rect = fm.boundingRect(" 100% ")
|
||||
rect.moveCenter(self.parent().contentsRect().center())
|
||||
self.setGeometry(rect)
|
||||
|
||||
|
|
|
@ -9,12 +9,10 @@ from PyQt5.QtGui import (
|
|||
QLinearGradient,
|
||||
QPixmap,
|
||||
QImage,
|
||||
QResizeEvent,
|
||||
)
|
||||
|
||||
from rare.models.game import RareGame
|
||||
from rare.utils.misc import format_size
|
||||
from rare.widgets.image_widget import ImageWidget
|
||||
from .game_widget import GameWidget
|
||||
from .list_widget import ListWidget
|
||||
|
||||
|
@ -70,23 +68,6 @@ class ListGameWidget(GameWidget):
|
|||
refactored to be used in downloads and/or dlcs
|
||||
"""
|
||||
|
||||
def event(self, e: QEvent) -> bool:
|
||||
if e.type() == QEvent.LayoutRequest:
|
||||
if self.progress_label.isVisible():
|
||||
width = int(self._pixmap.width() / self._pixmap.devicePixelRatioF())
|
||||
origin = self.width() - width
|
||||
fill_rect = QRect(origin, 0, width, self.sizeHint().height())
|
||||
self.progress_label.setGeometry(fill_rect)
|
||||
return ImageWidget.event(self, e)
|
||||
|
||||
def resizeEvent(self, a0: QResizeEvent) -> None:
|
||||
if self.progress_label.isVisible():
|
||||
width = int(self._pixmap.width() / self._pixmap.devicePixelRatioF())
|
||||
origin = self.width() - width
|
||||
fill_rect = QRect(origin, 0, width, self.sizeHint().height())
|
||||
self.progress_label.setGeometry(fill_rect)
|
||||
ImageWidget.resizeEvent(self, a0)
|
||||
|
||||
def prepare_pixmap(self, pixmap: QPixmap) -> QPixmap:
|
||||
device: QImage = QImage(
|
||||
pixmap.size().width() * 3,
|
||||
|
|
Loading…
Reference in a new issue