Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What is difference between qobject and q_object ?

What is difference between qobject and q_object ?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 416 Views
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on 10 May 2023, 09:39 last edited by
    #1

    i want to know difference between them. i want know when to use them ?

    S 1 Reply Last reply 10 May 2023, 10:26
    0
    • Q Qt embedded developer
      10 May 2023, 09:39

      i want to know difference between them. i want know when to use them ?

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 10 May 2023, 10:26 last edited by
      #2

      @Qt-embedded-developer QObject is a C++ class, Q_OBJECT is a macro. If you use this macro in your declaration of a subclass of QObject, it enables Qt's meta-object magic: signals, slots, bindings, meta enums, and meta object information.

      class MyClass : public QObject // <- class
      {
        Q_OBJECT // <- macro
      };
      

      (Z(:^

      J 1 Reply Last reply 10 May 2023, 10:39
      2
      • S sierdzio
        10 May 2023, 10:26

        @Qt-embedded-developer QObject is a C++ class, Q_OBJECT is a macro. If you use this macro in your declaration of a subclass of QObject, it enables Qt's meta-object magic: signals, slots, bindings, meta enums, and meta object information.

        class MyClass : public QObject // <- class
        {
          Q_OBJECT // <- macro
        };
        
        J Offline
        J Offline
        JonB
        wrote on 10 May 2023, 10:39 last edited by JonB 5 Oct 2023, 10:49
        #3

        @sierdzio
        How did you guess that OP's qobject meant QObject and q_object meant Q_OBJECT? Given what the OP typed for title and that C++ has always been case-significant I did not....

        S Q 2 Replies Last reply 10 May 2023, 10:41
        0
        • J JonB
          10 May 2023, 10:39

          @sierdzio
          How did you guess that OP's qobject meant QObject and q_object meant Q_OBJECT? Given what the OP typed for title and that C++ has always been case-significant I did not....

          S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 10 May 2023, 10:41 last edited by
          #4

          @JonB said in What is difference between qobject and q_object ?:

          @sierdzio
          How did you guess that OP's qobject meant QObject and q_object meant Q_OBJECT? Given what the Op typed and that C++ has always been case-significant I did not....

          I've used some serious deduction magic here :D Was hoping the OP would respond if my heuristic was off.

          (Z(:^

          1 Reply Last reply
          2
          • J JonB
            10 May 2023, 10:39

            @sierdzio
            How did you guess that OP's qobject meant QObject and q_object meant Q_OBJECT? Given what the OP typed for title and that C++ has always been case-significant I did not....

            Q Offline
            Q Offline
            Qt embedded developer
            wrote on 11 May 2023, 06:51 last edited by
            #5

            @JonB said in What is difference between qobject and q_object ?:

            QObject

            Dear i am talking about QObject vs Q_OBJECT.

            sorry for not write correctly .

            J 1 Reply Last reply 11 May 2023, 06:53
            0
            • Q Qt embedded developer has marked this topic as solved on 11 May 2023, 06:52
            • Q Qt embedded developer
              11 May 2023, 06:51

              @JonB said in What is difference between qobject and q_object ?:

              QObject

              Dear i am talking about QObject vs Q_OBJECT.

              sorry for not write correctly .

              J Offline
              J Offline
              JonB
              wrote on 11 May 2023, 06:53 last edited by
              #6

              @Qt-embedded-developer
              I get that now :) It's just so important in C/C++ to write things with their correct capitalization!

              1 Reply Last reply
              1

              1/6

              10 May 2023, 09:39

              • Login

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