745e2aa4 by 柴进

处理mac打包后粘贴图片缩略图不可见的问题,处理历史history不可见问题

1 parent cf1cdc86
...@@ -2197,10 +2197,41 @@ class ImageGeneratorWindow(QMainWindow): ...@@ -2197,10 +2197,41 @@ class ImageGeneratorWindow(QMainWindow):
2197 except Exception as e: 2197 except Exception as e:
2198 self.logger.error(f"创建缩略图失败: {file_path}, 错误: {str(e)}", exc_info=True) 2198 self.logger.error(f"创建缩略图失败: {file_path}, 错误: {str(e)}", exc_info=True)
2199 2199
2200 # 强制刷新布局和滚动区域(macOS 打包环境下可能需要) 2200 # 强制刷新布局和滚动区域
2201 self.img_container.adjustSize() 2201 self.img_container.adjustSize()
2202 self.img_layout.activate()
2202 self.img_scroll.update() 2203 self.img_scroll.update()
2203 2204
2205 # === 诊断日志:排查缩略图不可见问题 ===
2206 self.logger.info(f"[诊断] img_layout.count = {self.img_layout.count()}")
2207 self.logger.info(f"[诊断] img_container.size = {self.img_container.size().width()}x{self.img_container.size().height()}")
2208 self.logger.info(f"[诊断] img_container.isVisible = {self.img_container.isVisible()}")
2209 self.logger.info(f"[诊断] img_scroll.size = {self.img_scroll.size().width()}x{self.img_scroll.size().height()}")
2210 self.logger.info(f"[诊断] img_scroll.isVisible = {self.img_scroll.isVisible()}")
2211 self.logger.info(f"[诊断] img_scroll.widget = {self.img_scroll.widget()}")
2212 self.logger.info(f"[诊断] img_scroll.widgetResizable = {self.img_scroll.widgetResizable()}")
2213 for i in range(self.img_layout.count()):
2214 item = self.img_layout.itemAt(i)
2215 w = item.widget()
2216 if w:
2217 self.logger.info(
2218 f"[诊断] layout[{i}]: widget={w.__class__.__name__}, "
2219 f"size={w.size().width()}x{w.size().height()}, "
2220 f"sizeHint={w.sizeHint().width()}x{w.sizeHint().height()}, "
2221 f"visible={w.isVisible()}, "
2222 f"geometry={w.geometry()}"
2223 )
2224 # 检查子 widget
2225 for child in w.findChildren(QLabel):
2226 pm = child.pixmap()
2227 self.logger.info(
2228 f"[诊断] QLabel: size={child.size().width()}x{child.size().height()}, "
2229 f"visible={child.isVisible()}, "
2230 f"hasPixmap={pm is not None and not pm.isNull() if pm else False}"
2231 )
2232 else:
2233 self.logger.info(f"[诊断] layout[{i}]: spacer/stretch")
2234
2204 except Exception as e: 2235 except Exception as e:
2205 self.logger.error(f"更新图片预览失败: {str(e)}", exc_info=True) 2236 self.logger.error(f"更新图片预览失败: {str(e)}", exc_info=True)
2206 2237
......