New issue
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
[Bug]: 点击ComboBox闪退问题 #836
Comments
还会有这样的问题 File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 394, in mouseReleaseEvent File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 350, in _toggleComboMenu File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 341, in _showComboMenu File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 510, in exec File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\menu.py", line 726, in exec File "C:\Program Files\Python312\Lib\site-packages\qfluentwidgets\components\widgets\menu.py", line 856, in exec RuntimeError: wrapped C/C++ object of type QPropertyAnimation has been deleted` |
给个直接能跑的代码 |
没有办法复现 请给出完整的代码 from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from qfluentwidgets import *
from qfluentwidgets.window.fluent_window import FluentWindowBase
languagelist = [f"{i}" for i in range(100)]
class ComboboxSettingCard(SettingCard):
def __init__(self, icon, title, content, parent):
super().__init__(icon, title, content, parent)
self.combobox = ComboBox(self)
def resizeEvent(self, a0):
super().resizeEvent(a0)
self.combobox.setGeometry(self.width()-300, 20, 280, 30)
class SettingsDialog(FluentWindowBase):
def __init__(self, p=None):
super().__init__()
self.settings = []
self.setTitleBar(FluentTitleBar(self))
self.resize(900, 750)
self.appearance = SettingCardGroup("title")
self.listwidget = ListWidget(self)
self.listwidget.itemClicked.connect(self.itemClicked)
self.setlanguage = ComboboxSettingCard(
FluentIcon.LANGUAGE, "test", "text", self.appearance)
self.setlanguage.combobox.currentIndexChanged.connect(
self.applyLanguage)
self.appearance.addSettingCards([self.setlanguage])
self.appearance.move(10, self.titleBar.height())
self.appearance.resize(
self.width() - 20, self.height() - self.titleBar.height())
self.setLanguages()
self.addSetting("test", self.appearance)
def applyLanguage(self):
pass
def setLanguages(self):
row = 0
for i in languagelist:
self.setlanguage.combobox.addItem(i)
self.setlanguage.combobox.setCurrentIndex(0)
def addSetting(self, name: str, interface: QWidget):
self.stackedWidget.addWidget(interface)
self.settings.append(
[interface, QListWidgetItem(name, self.listwidget)])
self.listwidget.setCurrentRow(0)
def resizeEvent(self, e):
super().resizeEvent(e)
self.listwidget.setGeometry(
0, self.titleBar.height(), 300, self.height()-self.titleBar.height())
self.stackedWidget.setGeometry(
300, self.titleBar.height(), 600, self.height()-self.titleBar.height())
def itemClicked(self):
item = self.listwidget.currentRow()
interface = self.settings[item][0]
self.stackedWidget.setCurrentWidget(interface)
app = QApplication([])
dlg = SettingsDialog()
dlg.show()
app.exec() |
What happened?
我在子窗口上使用了ComboBox,点击它就会闪退并发生如下错误
Operation System
Windows11 23H2
Python Version
3.12.2 64bit
PyQt/PySide Version
PyQt5 5.15.10
PyQt/PySide-Fluent-Widgets Version
1.5.4
How to Reproduce?
报错
Minimum code
The text was updated successfully, but these errors were encountered: