Explain Qt build class details or ponit and correct my errors .
-
OK, I am going to abuse the purpose of this subforum - to discuss
anything C++_ land related.I need somebody to explain in English highlighted text in this post,
and please do not laugh or tell RTFM.
Opinions not related to subject....#ifndef A_TEST_CLASS_H #define A_TEST_CLASS_H #include <QObject> class A_TEST_Class : public QObject **class A_TEST inherits from (base class ) QObject true or false ?** { Q_OBJECT **what is the term for this here and why is it here ?** **base class has been specified already why this ?** public: explicit A_TEST_Class(QObject *parent = nullptr); **is there a reason using non ISO standard "parent " term here ? and give an example when "parent" would not be default null** **if it is null why is it there - is it not used then ?** signals: }; #endif // A_TEST_CLASS_H
class definition ( correct term ?)
OK, non ISO standard term "parent" is used again - fine#include "a_test_class.h" **bellow is an explicit constructor for purpose of passing parameters to class** A_TEST_Class::A_TEST_Class(**QObject *parent**) **what is the purpose of this and what is it call ?** **it is NOT "passing parameter to constrictor " or is it ?** : QObject{parent} QObject with default parent = nullptr is passed as class parameter correct ? so we have class derived from QObject and a QObject passed as a parameter too ? **is it a duplicate ?** { }
Please accept my apology for posting such basic stuff, but I am getting frustrated with non-standard terminology and "automatically generated " stuff by Qt which lacks explanations because of few "experts" here cannot be bothered and often pass RTFM instead.
Cheers
-
Christian Ehrlicher Lifetime Qt Championreplied to Anonymous_Banned275 on last edited by Christian Ehrlicher
@AnneRanch said in Explain Qt build class details or ponit and correct my errors .:
class A_TEST inherits from (base class ) QObject true or false ?
Correct
{
Q_OBJECT what is the term for this here and why is it here ?
base class has been specified already why this ?It's needed for Qt meta object system: https://doc.qt.io/qt-6/qobject.html#Q_OBJECT
public:
explicit A_TEST_Class(QObject *parent = nullptr);
**is there a reason using non ISO standard "parent " term here ?'parent' is just a name of a paramenter, don't know why this has to be iso-certified.
and give an example when "parent" would not be default null**
if it is null why is it there - is it not used then ?This is properly explained here: https://doc.qt.io/qt-6/objecttrees.html
is it a duplicate ?
No - once you derive from a QObject, the other one just passes a parameter of type QObject.
non-standard terminology
What exactly is non-standard - 'parent' - it's a parameter name and you should know what a 'parent' is.
"automatically generated " stuff by Qt which lacks explanations
Qt does automatically generated meta-object stuff explained in my links above and here: https://doc.qt.io/qt-6/moc.html
The ui to header generation is explained here: https://doc.qt.io/qt-6/designer-using-a-ui-file.htmlSo please tell us exactly what is non-standard or not documented properly here.
-
@Christian-Ehrlicher OK, your reply is pretty much following C++ inheritance , from base class ( QObject) to derived class.
Very simple instance would be
QObject base class
QWidget derived class
I have no suggestion in renaming these insisted of parent and child -- so let it be.
The task I am trying to accomplish , and maybe it is futile , is to
iterate "backwards " starting with derived class "up " to the base class.I have no issues iterating "frontwards" - from base class to derived class.
I have been looking at QTree derived classes and have not found them applicable for my task. .My inheritance layout is "multilevel " and I may have to figure out a way to iterate from base to derived classes and start "normal" from base .
The problem is my derived classes are dynamic - instantiated as needed.In simle term - why I cannot iterate from derived class to base class?
-
Christian Ehrlicher Lifetime Qt Championreplied to Anonymous_Banned275 on last edited by Christian Ehrlicher
@AnneRanch said in Explain Qt build class details or ponit and correct my errors .:
I have no suggestion in renaming these insisted of parent and child -- so let it be.
Nobody named the inheritance of classes as 'parent and child' - you just mix this up yourself. These are two different things but you refuse to understand this for unknown reasons...
Inheriting: A derives from B (QMainWindow derives from QWidget derives from QObject) - a QMainWindow is a QObject.
Parent - Child relationship (a.k.a Composition): A has a member (direct or indirect) of B - a QMainWindow has a central QWidget (which itself can be anything derived from QWidget).
These are basic c++ concepts which you constantly mix up and blame others for it.In simle term - why I cannot iterate from derived class to base class?
I don't know what you want here - do you mean casting?
-
To whom it MAY concern :
since this “discussion” is turning into mindless , robotic, and repetitive references to RTFM
AND so far has not provided solution to the issue ,
I am requesting the entire discussion to be scrapped , PERMANENTLY deleted from this forum.
It serves no porpoise to keep it as “unsolved” , it just occupies valuable space as such
It is of no public benefits to keep as “unsolved”.
PLEASE
REMOVE, DELETE PERMANENTLY ASAP.
Thank you for your support. -
I'm sorry that you have to read documentation if you want to learn something. Especially something such basic c++ stuff.