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 407 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 last edited by
    #1

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

    sierdzioS 1 Reply Last reply
    0
    • Q Qt embedded developer

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

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on 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(:^

      JonBJ 1 Reply Last reply
      2
      • sierdzioS sierdzio

        @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
        };
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #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....

        sierdzioS Q 2 Replies Last reply
        0
        • JonBJ JonB

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

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on 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
          • JonBJ JonB

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

            JonBJ 1 Reply Last reply
            0
            • Q Qt embedded developer has marked this topic as solved on
            • Q Qt embedded developer

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

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on 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

              • Login

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