Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. Q_PROPERTY is c++ macros?

Q_PROPERTY is c++ macros?

Scheduled Pinned Locked Moved The Lounge
6 Posts 4 Posters 2.3k Views 1 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.
  • R Offline
    R Offline
    rst256
    wrote on last edited by
    #1

    Hi.
    Who known Q_PROPERTY is c++ macros? And there his defined (in qobjectdefs.h just dummy).

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      Hi.

      See following useful links

      "moc":http://qt-project.org/doc/qt-5/metaobjects.html#meta-object-system

      1. "Q_PROPERTY":http://qt-project.org/doc/qt-5/qobject.html#Q_PROPERTY

      Hope this helps.

      Be Cute

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        Hi,

        the moc macros have two use cases:

        moc uses them to create the xxx_moc.cpp files. He ionterprets the content

        cpp compiler does not need them, so the define is a dummy.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rst256
          wrote on last edited by
          #4

          Thank you very much for the detailed answer.
          It's like, it's an interesting technique. Now I have no doubt that this is the only possible way extend the standard preprocessor macros functionality.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Please keep in mind that Qt is already quite old. Chances are, that if it were designed from the ground up today, it would not come up with moc again. However, back in the day, template support in C++ was still in its infancy, and Qt has needed to support compilers for lots of different platforms over the years, some of which with quite old toolchains. Also, computers were less powerfull back then.

            So, it might be possible that if Qt were designed today, the issues that moc is now solving would have been approached differently, perhaps with templates. Or not.

            There is even experimental work around that basically replaces moc with Clang extensions. Extremely cool. Clang allows you to augment the actual compiler, and so it becomes possible to define your own keywords and insert code based on this. Last I heard from it, it produces working code... But as we cannot all rely on Clang, and other compilers that Qt is supporting don't offer the same functionality yet, I think we're going to be stuck with moc for a while longer.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rst256
              wrote on last edited by
              #6

              I recommend to look at here is what kind of tools:
              http://clang.llvm.org/docs/ClangTools.html

              Use then if new api lost backward compatibility

              1 Reply Last reply
              0

              • Login

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