Why some classess are QObject?
-
Hello,
Could you tell me why some classess in their constructor have parent?
For example: QTimer(QObject *parent = nullptr).
I understand why parent is important in QWidget. When I have QDialog and I would like to have QPushButton on it I can set that QPushButton as child that QDialog. And when I move QDialog I move QPushButton too. And when I set QPushButton's position to (0,0), this position is not a global position, but position in QDialog.
But why have to set parent in QTimer? Only because of I don't have to delete that QTimer when I delete QDialog? Or maybe something else?
-
Hello,
Could you tell me why some classess in their constructor have parent?
For example: QTimer(QObject *parent = nullptr).
I understand why parent is important in QWidget. When I have QDialog and I would like to have QPushButton on it I can set that QPushButton as child that QDialog. And when I move QDialog I move QPushButton too. And when I set QPushButton's position to (0,0), this position is not a global position, but position in QDialog.
But why have to set parent in QTimer? Only because of I don't have to delete that QTimer when I delete QDialog? Or maybe something else?
-
@KroMignon Yeah, I forget about it :D
-
@KroMignon Yeah, I forget about it :D