[Interest] how to add comments of member function defined with macro?

tang ke tangk at lemote.com
Tue Feb 26 06:08:14 CET 2013


On 02/26/2013 12:32 PM, Sze Howe Koh wrote:
> On 26 February 2013 11:54, tang ke <tangk at lemote.com> wrote:
>> Hey everybody!
>> How can I use the macro with qdoc?
>> Such as:
>> I defined a macro with macro-def.h
>>
>> #define _DECLARE_INT2ENUMSTRING(Enum) \
>> QString int2string(int value) { \
>> const QMetaObject* meta = this->metaObject(); \
>> for (int j = 0; j < meta->enumeratorCount(); ++j) { \
>> QMetaEnum m = meta->enumerator(j); \
>> if(QString(m.name()) == QString(Enum)) { \
>> return QString(m.valueToKey(value)); \
>> } \
>> } \
>> return QString(""); \
>> }
>>
>> with class header file, I use this macro to define a member function.
>>
>> _DECLARE_INT2ENUMSTRING("BUTTON")
>>
>> so How can I add the comments of this member function?
> You can use the \fn command:
> http://doc-snapshot.qt-project.org/qt5-stable/qdoc/13-qdoc-commands-topics.html#fn-command
>
> Note that the comment must be in a .cpp file, not a .h file.
>
> Why don't you create a normal function, instead of using a macro?
yes, I know use the \fn tags to the member function.

My defined macro such as Q_OBJECT, the macro will define the common 
member function.
>
> Regards,
> Sze-Howe
>


-- 
应用部  唐科
TEL : 0512-52308661-88686
FAX: 0512-52308688
MP : 18962393077
E-mail: tangk at lemote.com
地址:江苏省常熟市虞山镇梦兰工业园




More information about the Interest mailing list