`findChildren(QFrame)` also find QLabel object
Solved
Qt for Python
-
I use
findChildren(QFrame)
to get all the QFrame objects in a QDialog.all_frames = frame.parent().findChildren(QFrame) pdb.set_trace()
But
all_frames
also include QLabel object, why?[<PySide6.QtWidgets.QFrame(0x234b2bea190, name="frame") at 0x00000234ADEE4CC0>, <PySide6.QtWidgets.QLabel(0x234b2be9b00, name="label_1") at 0x00000234ADEE4E00>, <PySide6.QtWidgets.QFrame(0x234b2bea5e0, name="frame_2") at 0x00000234ADEE4E40>, <PySide6.QtWidgets.QLabel(0x234b2bea5b0, name="label_2") at 0x00000234ADEE4F40>, <PySide6.QtWidgets.QFrame(0x234b2bea520, name="frame_3") at 0x00000234ADEE4FC0>, <PySide6.QtWidgets.QLabel(0x234b2b9b360, name="label_3") at 0x00000234ADEE5140>, <PySide6.QtWidgets.QFrame(0x234b2b9b870, name="frame_4") at 0x00000234ADEE51C0>, <PySide6.QtWidgets.QLabel(0x234b2b9b270, name="label_4") at 0x00000234ADEE5300>, <PySide6.QtWidgets.QLabel(0x234b2b9b180, name="label_task") at 0x00000234ADEE5380>]
-
@feiyuhuahuo
Because if you look at QLabel Class you can see it inherits fromQFrame
.