Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PyQt ですべてのQLineEditオブジェクトのコレクションを取得する方法はありますか?
QLineEdit
フォーム上のすべてのテキストをすべて消去するリセット ボタンを追加しようとしているので、リセット ボタンに接続するリセット関数にすべてのオブジェクトをリストするのではなく、QLineEditすべてのオブジェクトをループする方法を探しています。QLineEdit
ありがとうございました。
すべての行編集に親がある場合は、次を使用できます。
for child in parent.findChildren(QtGui.QLineEdit): child.clear()
またはおそらく:
for widget in qApp.allWidgets(): if isinstance(widget, QtGui.QLineEdit): widget.clear()