This commit is contained in:
恍兮惚兮 2024-12-27 20:00:08 +08:00
parent 4225465074
commit ece7f83e1d
3 changed files with 23 additions and 11 deletions

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 6) set(VERSION_MAJOR 6)
set(VERSION_MINOR 15) set(VERSION_MINOR 16)
set(VERSION_PATCH 6) set(VERSION_PATCH 0)
set(VERSION_REVISION 0) set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)

View File

@ -275,6 +275,8 @@ class IMGWidget(QLabel):
return size return size
def setimg(self, pixmap: QPixmap): def setimg(self, pixmap: QPixmap):
if pixmap.isNull():
return
if not (self.height() and self.width()): if not (self.height() and self.width()):
return return
if self.__last == (self.size(), globalconfig["imagewrapmode"]): if self.__last == (self.size(), globalconfig["imagewrapmode"]):
@ -350,7 +352,6 @@ class ItemWidget(QWidget):
self.doubleclicked.emit(self.gameuid) self.doubleclicked.emit(self.gameuid)
def resizeEvent(self, a0: QResizeEvent) -> None: def resizeEvent(self, a0: QResizeEvent) -> None:
self.__w.resize(a0.size())
self.bottommask.resize(a0.size()) self.bottommask.resize(a0.size())
self.maskshowfileexists.resize(a0.size()) self.maskshowfileexists.resize(a0.size())
self._imgsz() self._imgsz()
@ -374,6 +375,24 @@ class ItemWidget(QWidget):
self.width() - 2 * margin, self.width() - 2 * margin,
self.height() - textH - 2 * margin, self.height() - textH - 2 * margin,
) )
if self._img._pixmap.isNull():
self._lb.setGeometry(
margin,
max(
margin,
self.height() - self._lb.heightForWidth(self.width()) - margin,
),
self.width() - 2 * margin,
min(self.height() - 2 * margin, self._lb.heightForWidth(self.width())),
)
else:
self._lb.setGeometry(
margin,
self.height() - textH - margin,
self.width() - 2 * margin,
textH,
)
def __init__(self, gameuid, pixmap, file) -> None: def __init__(self, gameuid, pixmap, file) -> None:
super().__init__() super().__init__()
@ -381,17 +400,11 @@ class ItemWidget(QWidget):
self.file = file self.file = file
self.maskshowfileexists = QLabel(self) self.maskshowfileexists = QLabel(self)
self._img = IMGWidget(self, pixmap) self._img = IMGWidget(self, pixmap)
self.__w = QWidget(self)
self.__w.setStyleSheet("background:transparent")
self._lb = QLabel(self) self._lb = QLabel(self)
self._lb.setText(file if globalconfig["showgametitle"] else "") self._lb.setText(file if globalconfig["showgametitle"] else "")
self._lb.setWordWrap(True) self._lb.setWordWrap(True)
self._lb.setObjectName("savegame_textfont1") self._lb.setObjectName("savegame_textfont1")
self._lb.setAlignment(Qt.AlignmentFlag.AlignHCenter) self._lb.setAlignment(Qt.AlignmentFlag.AlignHCenter)
l = QVBoxLayout(self.__w)
l.setContentsMargins(0, 0, 0, 0)
l.addStretch(1)
l.addWidget(self._lb)
exists = os.path.exists(get_launchpath(gameuid)) exists = os.path.exists(get_launchpath(gameuid))
self.maskshowfileexists.setObjectName("savegame_exists" + str(exists)) self.maskshowfileexists.setObjectName("savegame_exists" + str(exists))
if not exists: if not exists:

View File

@ -202,8 +202,7 @@ def getExeIcon(name: str, icon=True, cache=False):
pass pass
# print_exc() # print_exc()
if succ == False: if succ == False:
pixmap = QPixmap(100, 100) pixmap = QPixmap()
pixmap.fill(QColor.fromRgba(0))
if icon: if icon:
return QIcon(pixmap) return QIcon(pixmap)
else: else: