e6410bd2 by 柴进

清理无用代码

1 parent 8b46fb30
...@@ -1133,7 +1133,7 @@ class DragDropScrollArea(QScrollArea): ...@@ -1133,7 +1133,7 @@ class DragDropScrollArea(QScrollArea):
1133 if mime_data.hasImage(): 1133 if mime_data.hasImage():
1134 image = mime_data.imageData() 1134 image = mime_data.imageData()
1135 if isinstance(image, QImage) and not image.isNull(): 1135 if isinstance(image, QImage) and not image.isNull():
1136 self.parent_window.add_clipboard_image(image) 1136 self.parent_window.add_clipboard_image(image.copy())
1137 event.acceptProposedAction() 1137 event.acceptProposedAction()
1138 return 1138 return
1139 except Exception: 1139 except Exception:
...@@ -1934,13 +1934,13 @@ class ImageGeneratorWindow(QMainWindow): ...@@ -1934,13 +1934,13 @@ class ImageGeneratorWindow(QMainWindow):
1934 if raw_data and len(raw_data) > 0: 1934 if raw_data and len(raw_data) > 0:
1935 image = QImage() 1935 image = QImage()
1936 if image.loadFromData(raw_data): 1936 if image.loadFromData(raw_data):
1937 return image 1937 return image.copy()
1938 1938
1939 # 尝试 hasImage + imageData 1939 # 尝试 hasImage + imageData
1940 if mime_data.hasImage(): 1940 if mime_data.hasImage():
1941 image_data = mime_data.imageData() 1941 image_data = mime_data.imageData()
1942 if isinstance(image_data, QImage) and not image_data.isNull(): 1942 if isinstance(image_data, QImage) and not image_data.isNull():
1943 return image_data 1943 return image_data.copy()
1944 except Exception as e: 1944 except Exception as e:
1945 self.logger.warning(f"MIME data 方式获取剪贴板图像失败: {e}") 1945 self.logger.warning(f"MIME data 方式获取剪贴板图像失败: {e}")
1946 1946
...@@ -1971,7 +1971,7 @@ class ImageGeneratorWindow(QMainWindow): ...@@ -1971,7 +1971,7 @@ class ImageGeneratorWindow(QMainWindow):
1971 if result.returncode == 0 and temp_path.exists() and temp_path.stat().st_size > 0: 1971 if result.returncode == 0 and temp_path.exists() and temp_path.stat().st_size > 0:
1972 image = QImage(str(temp_path)) 1972 image = QImage(str(temp_path))
1973 if not image.isNull(): 1973 if not image.isNull():
1974 return image 1974 return image.copy()
1975 except Exception as e: 1975 except Exception as e:
1976 self.logger.warning(f"osascript 方式获取剪贴板图像失败: {e}") 1976 self.logger.warning(f"osascript 方式获取剪贴板图像失败: {e}")
1977 1977
...@@ -1979,7 +1979,7 @@ class ImageGeneratorWindow(QMainWindow): ...@@ -1979,7 +1979,7 @@ class ImageGeneratorWindow(QMainWindow):
1979 try: 1979 try:
1980 image = clipboard.image() 1980 image = clipboard.image()
1981 if image and not image.isNull(): 1981 if image and not image.isNull():
1982 return image 1982 return image.copy()
1983 except Exception as e: 1983 except Exception as e:
1984 self.logger.warning(f"clipboard.image() 失败: {e}") 1984 self.logger.warning(f"clipboard.image() 失败: {e}")
1985 1985
......