2
\$\begingroup\$

I've been searching the internet and cannot find a proper answer as when one should user "Parent" and "Child". I see these two used all over, I have not used them myself in my programs, and now I'm wondering if I have missed something in creating my software. I am wondering why and when should they be used. I've only gathered that they should be used when one class controls another. Only thing I have done in that sense is call another class/window, from a class. Example below.

class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()

        self.doSomething

class Child(QtWidgets.QWidget)
    def __init__(self, Parent)
        super(Child, self).__init__(Parent)

        self.doSomething
\$\endgroup\$
3
  • 1
    \$\begingroup\$ This is more of a question for Software Engineering Stack Exchange (if it's about parent/child classes in general) or Stack Overflow if it's about these classes specifically in QT. \$\endgroup\$
    – l0b0
    Aug 28 '19 at 8:35
  • 1
    \$\begingroup\$ We only review real working code. Details matter! In order to give good advice, we need to see real, concrete code, and understand the context in which the code is used. Visit our help center to find out more how to ask a question: codereview.stackexchange.com/help/on-topic. \$\endgroup\$
    – dfhwze
    Aug 28 '19 at 9:23
  • \$\begingroup\$ Thanks anyways. I did not know about Software Engineering Stack Exchange. Only just started using any Stack Exchange. \$\endgroup\$
    – Chris B
    Aug 29 '19 at 5:11

Browse other questions tagged or ask your own question.