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. Moc does not support preprocess?
Forum Updated to NodeBB v4.3 + New Features

Moc does not support preprocess?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.4k 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.
  • I Offline
    I Offline
    ibingow
    wrote on last edited by
    #1

    myobject.h:
    @
    #include <QObject>
    #define DECLARE_FUNC(type, func)
    public: type func;
    signals: type sig_##func;
    protected slots: type slot_##func;

    class MyObject :public QObject {
    Q_OBJECT
    DECLARE_FUNC(void hello())
    }@

    the i use moc to generate moc_myobject.cpp
    @moc $DEFINES $INCPATH myobject.h -o moc_myobject.cpp@

    i find that no signal and slot code in moc_myobject.cpp

    but if i use
    @cpp $DEFINES $INCPATH myobject.h |moc >moc_myobject.cpp@
    then this moc_myobject.cpp is what i want.

    So i guess moc can not support preprocess well. If it is true, I think it's better to change the default rule to generate moc_xxx.cpp in Makefile.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      You're correct: moc does not expand defines. I'm not sure however about what you're trying to accomplish with that macro.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thisisbhaskar
        wrote on last edited by
        #3

        I was reading some moc related material today, and this was one point that I came across..

        http://doc.qt.nokia.com/latest/moc.html

        see under "Limitations" section.

        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