Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Explain Qt build class details or ponit and correct my errors .
Forum Updated to NodeBB v4.3 + New Features

Explain Qt build class details or ponit and correct my errors .

Scheduled Pinned Locked Moved Unsolved C++ Gurus
6 Posts 2 Posters 484 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on 11 May 2024, 00:23 last edited by
    #1

    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

    C 1 Reply Last reply 11 May 2024, 05:50
    0
    • A Anonymous_Banned275
      11 May 2024, 00:23

      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

      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 11 May 2024, 05:50 last edited by Christian Ehrlicher 5 Nov 2024, 06:12
      #2

      @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.html

      So please tell us exactly what is non-standard or not documented properly here.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      A 1 Reply Last reply 11 May 2024, 21:11
      4
      • C Christian Ehrlicher
        11 May 2024, 05:50

        @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.html

        So please tell us exactly what is non-standard or not documented properly here.

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on 11 May 2024, 21:11 last edited by
        #3

        @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?

        C 1 Reply Last reply 12 May 2024, 06:41
        0
        • A Anonymous_Banned275
          11 May 2024, 21:11

          @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?

          C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 12 May 2024, 06:41 last edited by Christian Ehrlicher 5 Dec 2024, 07:46
          #4

          @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?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          A 1 Reply Last reply 12 May 2024, 14:51
          2
          • C Christian Ehrlicher
            12 May 2024, 06:41

            @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?

            A Offline
            A Offline
            Anonymous_Banned275
            wrote on 12 May 2024, 14:51 last edited by
            #5

            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.

            1 Reply Last reply
            0
            • C Online
              C Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 12 May 2024, 15:03 last edited by
              #6

              I'm sorry that you have to read documentation if you want to learn something. Especially something such basic c++ stuff.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              5

              6/6

              12 May 2024, 15:03

              • Login

              • Login or register to search.
              6 out of 6
              • First post
                6/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved