We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageLabel
MessageBoxBase
ImageLabel 和 MessageBoxBase 组合使用的时候会产生内存泄漏,注意当使用 QDialog 时没有该问题产生
最小复现代码
import requests from PyQt5.QtCore import QThreadPool, pyqtSignal from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QApplication, QDialog, QPushButton, QVBoxLayout, QWidget from qfluentwidgets import ImageLabel, MessageBoxBase class ImageDialog(MessageBoxBase): imageDataFetched = pyqtSignal(bytes) def __init__(self, parent: QWidget | None = None) -> None: super().__init__(parent) # self.mainLayout = QVBoxLayout(self) self.posterLabel = ImageLabel(self) self.viewLayout.addWidget(self.posterLabel) self.imageDataFetched.connect(self.setImage) QThreadPool.globalInstance().start(self.fetchImage) def fetchImage(self) -> None: resp = requests.get("https://qfluentwidgets.com/img/features/dark-store.jpg") self.imageDataFetched.emit(resp.content) def setImage(self, imgData: bytes) -> None: img = QPixmap() img.loadFromData(imgData) self.posterLabel.setPixmap(img) class View(QWidget): def __init__(self) -> None: super().__init__() self.resize(400, 300) self.mainLayout = QVBoxLayout(self) self.btn = QPushButton("show dialog", self) self.btn.clicked.connect(self.showDialog) self.mainLayout.addWidget(self.btn) def showDialog(self) -> None: dialog = ImageDialog(self) dialog.exec() if __name__ == "__main__": app = QApplication([]) view = View() view.show() app.exec()
The text was updated successfully, but these errors were encountered:
修复自定义样式导致的内存泄漏问题 (#977)
95992ab
已修复此问题
Sorry, something went wrong.
No branches or pull requests
ImageLabel
和MessageBoxBase
组合使用的时候会产生内存泄漏,注意当使用 QDialog 时没有该问题产生最小复现代码
The text was updated successfully, but these errors were encountered: