更新时间:2023-01-26 23:34:30
没有清除所有输入的方法.一个简单的解决方案是使用 findChildren 方法遍历小部件:
There is no method that cleans all the inputs. A simple solution is to iterate over the widgets using the findChildren method:
for widget in parent_widget.findChildren([QLineEdit, QComboBox]):
if hasattr(widget, "clear") and callable(widget.clear):
widget.clear()
或
for widget in parent_widget.findChildren(QWidget):
if not isinstance(widget, QLabel) and hasattr(widget, "clear") and callable(widget.clear):
widget.clear()