c++qtqt4deprecatedobsolete

How to mark something in Qt as obsolete(deprecated)?


Is there Q_OBSOLETE or Q_DEPRECATED in C++ with Qt 4.7?

Or is there a similar C++ macro or keyword?


Solution

  • 2023:

    Yes, the Qt is defined QT_DEPRECATED and QT_DEPRECATED_X macros for this purpose:

    QT_DEPRECATED void myOldFunc();
    QT_DEPRECATED_X("use myNewFunc instead") void myOldFunc2();
    

    difference is just the text message.
    Also the C++14 presents [[deprecated("text")]] attribute as standard. It seems that this attribute is used under the hood if you use C++ 14+.