why do we subclass QWidget when we are creating a new class?
-
why do we subclass QWidget when we are creating a new class?
-
@majeed
You subclassQWidget
--- or perhaps some more specific widget derived fromQWidget
--- if you are designing a new class which will be/behave like a widget. So that you get widget behaviour & functionality.However, if your new class has nothing to do with widgets, you wouldn't subclass from
QWidget
....
-
sir why is it necessary to pass parent pointer to bass class constructor
-
@majeed Please read http://doc.qt.io/qt-5/objecttrees.html
-
@jsulm why do we pass Qwidget pointer to the base class constructor?
-
Its the parent.
When parent is deleted it will delete all other widget that it is parent for.
Its auto clean up as the link
@jsulm shows. it explains it all.
-
@majeed Did you read the link? If not why? It is explained there...