Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Calling __init__() in QObject subclasses
Forum Updated to NodeBB v4.3 + New Features

Calling __init__() in QObject subclasses

Scheduled Pinned Locked Moved Unsolved Qt for Python
15 Posts 6 Posters 5.1k Views 4 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.
  • JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by JonB
    #4

    @Denni-0
    It's a very simple question. Nothing to do with slots, connections, potential issues, super, 3 issues, or anything else. Not to do with what one might or might not consider better style. There are no "underlying wrapper that has been created by someone else".

    Without answering about anything else, are you saying

    class DerivedClass(BaseClass):
        def __init__(self):
            BaseClass.__init__(self)
    

    behaves differently from

    class DerivedClass(BaseClass):
        pass
    

    ? I'd like to know. If so, could you provide a reference so I can read up. Thanks.

    1 Reply Last reply
    -1
    • JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #5

      @Denni-0 said in 'PySide2.QtCore.Signal' object has no attribute 'emit':

      troll question

      I never ask "troll" questions. Life is too short.

      In my example I don't particularly intend BaseClass to be derived from QObject, else I would have stated that explicitly. Though it could be, if that makes any difference to the answer.

      I have since looked around and seen much code (both Qt and non-Qt) which does indeed not bother to declare an explicit __init__() constructor in a derived class if it does not need to do anything other than class the base class constructor. At the moment from reading around I am happy that the default behaviour of a derived class with no explicit __init__(), which is to call base class __init__() automatically, suffices. Unless you have a reference to the contrary?

      1 Reply Last reply
      -1
      • JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #6

        @Denni-0 said in 'PySide2.QtCore.Signal' object has no attribute 'emit':

        BTW if you had come to me respectfully with your question I would have been more than happy to have explained this to you in that manner but you chose to be basically disrespectful in your approach

        because you simply cannot comprehend the basic coding principles of Object Oriented programming let alone Function Oriented programming and I would suggest you go back to linear coding as you will cause a lot less harm with your programs.

        OK, if that's how you feel and speak let's call it a day. Nobody other than you speaks to people like this in this forum.

        1 Reply Last reply
        0
        • JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #7

          @Denni-0
          I have been careful to be polite in everything I have ever posted in response to you, always saying you have your opinions and others have theirs. You are just rude and abusive. Nobody other than you accuses others of lying, trolling, or the endless stream of insults you throw in your responses. I guess in all my career I have never come across anyone like you in a professional or technical environment. I still remember the first post I saw from you where you announced that @Pablo-J-Rogina was a "troll" and you would have him banned. It's a shame you are allowed to do so.

          We have nothing more to say to each other.

          kshegunovK 1 Reply Last reply
          1
          • JonBJ JonB

            @Denni-0
            I have been careful to be polite in everything I have ever posted in response to you, always saying you have your opinions and others have theirs. You are just rude and abusive. Nobody other than you accuses others of lying, trolling, or the endless stream of insults you throw in your responses. I guess in all my career I have never come across anyone like you in a professional or technical environment. I still remember the first post I saw from you where you announced that @Pablo-J-Rogina was a "troll" and you would have him banned. It's a shame you are allowed to do so.

            We have nothing more to say to each other.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #8

            @JonB said in Calling __init__() in QObject subclasses:

            I guess in all my career I have never come across anyone like you in a professional or technical environment.

            I have. I suppose you've just occupied a less hostile time and place in the universe.

            I still remember the first post I saw from you where you announced that @Pablo-J-Rogina was a "troll" and you would have him banned.

            Heh, that's actually rather funny.

            It's a shame you are allowed to do so.

            Personally, I'm very lenient, less personally - willfully treading on thin ice is going to get you into the freezing water, sooner or later.

            Read and abide by the Qt Code of Conduct

            ODБOïO 1 Reply Last reply
            1
            • kshegunovK kshegunov

              @JonB said in Calling __init__() in QObject subclasses:

              I guess in all my career I have never come across anyone like you in a professional or technical environment.

              I have. I suppose you've just occupied a less hostile time and place in the universe.

              I still remember the first post I saw from you where you announced that @Pablo-J-Rogina was a "troll" and you would have him banned.

              Heh, that's actually rather funny.

              It's a shame you are allowed to do so.

              Personally, I'm very lenient, less personally - willfully treading on thin ice is going to get you into the freezing water, sooner or later.

              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by ODБOï
              #9

              @kshegunov said in Calling __init__() in QObject subclasses:

              get you into the freezing water

              it is beneficial for your health

              kshegunovK 1 Reply Last reply
              0
              • ODБOïO ODБOï

                @kshegunov said in Calling __init__() in QObject subclasses:

                get you into the freezing water

                it is beneficial for your health

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #10

                @LeLev said in Calling __init__() in QObject subclasses:

                it is beneficial for your health

                Ordinarily I'd agree, but the deadly sniffles is afoot, so I'd advise against it.

                Read and abide by the Qt Code of Conduct

                JKSHJ 1 Reply Last reply
                0
                • kshegunovK kshegunov

                  @LeLev said in Calling __init__() in QObject subclasses:

                  it is beneficial for your health

                  Ordinarily I'd agree, but the deadly sniffles is afoot, so I'd advise against it.

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by JKSH
                  #11

                  @JonB said in Calling __init__() in QObject subclasses:

                  I don't understand what you mean by "make sure that the __init__ of the QObject is called". I do not define any def __init__(self) method of my class someClass(QObject), and it works fine. Just deriving from QObject (or from any class) calls its __init__() automatically.

                  While I don't have experience with PySide, I read @KeirRice's comment as saying: "IF you implement a custom __init__() method, THEN remember to explicitly call the base implementation of __init__()."

                  Does that sound right to you?

                  @kshegunov said in Calling __init__() in QObject subclasses:

                  the deadly sniffles

                  That's the first time I've heard it called that. It's a disturbingly cute name.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  1
                  • kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #12

                    @Denni-0 said in Calling __init__() in QObject subclasses:

                    @kshegunov the interesting thing I found is that JonB did not feel he was doing anything impolite as he feels every unrelated completely off topic manipulative comment he has made was simply him being polite.

                    What he feels or doesn't feel is beside the point. He asked an acceptable question, and even if you think it may've been manipulative, well sorry, you're just gonna have to eat it.

                    Which is ironic because that by nature is not a polite thing to do however I have no problems with giving back what I am given which is to say try to bully me and I get right in your grill

                    I don't grill. I have a very thick skin that's been growing thicker by merit of my living in eastern Europe. I don't care about political correctness, nor do I employ it, nor do I agree with it. I call it as I see it, if you don't like that then I suggest refraining from talking to me. Don't try to test the patience of the moderators group, we are decent enough bunch and allow a lot of freedom, but that doesn't mean disruptive aggressive behaviour is going to be tolerated for too long a time. This is not a discussion, mind you, I'm telling you how things are.

                    I am currently trying to find out what their definition of trolling is.

                    Trying to hijack the technical discussion on multiple occasions by arguing moderators' decisions is one form of trolling. Everyone is entitled to their opinion, but that doesn't mean everyone else is entitled to listening to their opinion, like with the "entitled" tone in the second part of your post. If you think this is some kind of a democracy where your opinion of what's trolling weighs more than say @SGaist's, then I must assure you you're sorely mistaken. Blatantly disrespectful tone and going around telling everybody you're smart and they're dumb doesn't fly well, neither in earning respect, nor in soliciting support for your point.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    4
                    • kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #13

                      @Denni-0 said in Calling __init__() in QObject subclasses:

                      Yeah and your post was highly technical and spot on the original topic which is Calling init() in QObject subclasses --- NOT Best not to point fingers when you are extremely guilty yourself. Further its an extreme exaggeration "on multiple occasions?" or your math is really bad

                      Are we arguing? I told you already, this is not a discussion.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      0
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        @Denni-0
                        Since we are talking facts.
                        Im the most friendly mod here and frankly, you are the first troll-like person i have seen here.

                        I understand you feel deeply about__INIT__ but you resort to name-calling and aggressive behavior
                        and insist that our long term users are trolling.

                        So can you please dial it down a notch?

                        1 Reply Last reply
                        3
                        • kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #15

                          @Denni-0 said in Calling __init__() in QObject subclasses:

                          okay so you have ended this thread then?

                          Yes, metaphorically and literally.

                          Also I am assuming by your statements that you have made earlier that you have moderator power otherwise you would not be so abusive yourself?

                          When you assume ... and you know the rest. I've openly said already I am a moderator.

                          Read and abide by the Qt Code of Conduct

                          1 Reply Last reply
                          1

                          • Login

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