Important: Please read the Qt Code of Conduct -

A class declared by a macro can not be shown with all members in Class View of QtCreator

  • Hello, every one.
    I'm declaring some classes with a macro, because these classes have same member variables and functions. My macro is defined as follow:

    #define DECL_SENTENCE_CLASS(_SentenceClass, _DataType, ...)             \
    class _SentenceClass : public BasicSentence                             \
    {                                                                       \
    public:                                                                 \
       _DataType data;                                                      \
    protected:                                                              \
       virtual bool isThisFrame(char const* pfrmbuff, int bytesAvailable);  \
       virtual int composeFrame(char* pfrmbuff, int maxbytes,               \
                                logstream::LogStream* plogstream = NULL);   \
       virtual bool extractDatas(char const* pfrmbuff, int bytes,           \
                                 logstream::LogStream* plogstream = NULL);  \
    public:                                                                 \
       _SentenceClass(__VA_ARGS__);                                       \
       ~_SentenceClass();                                                   \
       virtual U2 totalSentenceCount(void)                                  \
       { return data.msginfo.r.TotalMsgCnt; }                               \
       virtual void setTotalSentenceCount(U2 count)                         \
       { data.msginfo.x.TotalMsgCnt = count; }                              \
       virtual U2 currentSentenceCount(void)                                \
       { return data.msginfo.r.LastProcessNum; }                            \
       virtual void setCurrentSentenceCount(U2 count)                       \
       { data.msginfo.x.ProcessedCnt = count; }                             \

    When I use this macro to declare a class, for example:
    DECL_SENTENCE_CLASS(TestSentence, _tTestSentenceData)
    The class named 'TestSentece' can be shown in classview of QtCreator, but only constructor and destructor can be shown in the subtree of the class, the others, such as member variable 'data', virtual member function 'totalSentenceCount' can not be found in the subtree.

    I think maybe this is a small bug in classview plugin, could anyone check it?
    BTW: I'm using QtCreator v3.4.1, which is compiled with MinGW-w64 4.9.2 in MSYS2