Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题背景
在使用串口时,由于经常要插拔串口,导致串口数量总是不固定
在这个背景下,我需要使用ComboBoxSettingCard,并在下框被点击时重新获取所有串口
业务代码
问题描述
当串口数量变化且用以上代码刷新后,之后再当
COMCard
下拉框选中的值改变时,不能将值保存到config.json
中##原因分析
cfg.port = OptionsConfigItem("Serial", "COM", "COM3", OptionsValidator(cfg.portList))
,为cfg.port
重新赋值config.json
时调用了qfluentwidgets\common\config.py
中QConfig
类的toDict
方法,其中用以下代码读取类成员的值.__class__
导致读取类成员的值时,读到的是cfg.port重新赋值之前的值,原因我不知道解决方法
去掉
.__class__
去掉后功能正常,但暂不清楚是否有其他影响