Is a very basic QT question :
At adressbook example I see :
Qt Code:
To copy to clipboard, switch view to plain text mode
Why it is not neccesary to pass parent ?
Thanks
Is a very basic QT question :
At adressbook example I see :
Qt Code:
To copy to clipboard, switch view to plain text mode
Why it is not neccesary to pass parent ?
Thanks
If I understand correctly - In this example NewAddressTab is subclassing QWidget, why would it need a parent?
It has no parent, cause it is the main widget
I cannot be sure though, that anything i said is true...
In the sense of, for example, another element extending Qtabwidget is written :
Why then NewAddresTab are not like this :Qt Code:
To copy to clipboard, switch view to plain text mode
????Qt Code:
To copy to clipboard, switch view to plain text mode
Because this example is using QWidget's default constructor.
You could pass the parent to QWidget if you wanted to.
Its a matter of design decision based on the needs and uses of the class and software.
I don't know why the trolls decided to declare the constructor with a parent, but not use it.
Maybe originally it was meant to be destroyed by the parent as Qt classes do.
This one however will not.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Aha ! I understand.
Thanks
Bookmarks