Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Un-deprecate your Qt project


#if QT_DEPRECATED_SINCE(5, 2)
template <typename RandomAccessIterator>
QT_DEPRECATED_X("Use std::sort") inline void qSort(RandomAccessIterator start, RandomAccessIterator end) { ... }
#endif

// QT_VERSION_CHECK turns its arguments in the 0xMMmmpp form
#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)

# disable all the deprecated APIs in Qt <= 5.8
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050800

DEFINES += QT_DEPRECATED_WARNINGS # warn on usage of deprecated APIs

# warn on *any* usage of deprecated APIs, no matter in which Qt version they got marked as deprecated ...
DEFINES += QT_DEPRECATED_WARNINGS 

# ... and just fail to compile if APIs deprecated in Qt <= 5.6 are used
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050600

About KDAB


3 Comments

27 - Jan - 2017

Taylor Braun-Jones

5 - Feb - 2017

Giuseppe D'Angelo

29 - Aug - 2020

Ben

/home/bhaller/Desktop/SLiM/QtSLiM/QtSLiMWindow.cpp:1957:39: warning: ‘void QTextEdit::setTabStopWidth(int)’ is deprecated [-Wdeprecated-declarations]
 1957 |     textEdit->setTabStopWidth(tabWidth);
      |                                       ^
In file included from /home/bhaller/Qt/5.14.2/gcc_64/include/QtWidgets/QTextEdit:1,
                 from /home/bhaller/Desktop/SLiM/QtSLiM/QtSLiMScriptTextEdit.h:23,
                 from /home/bhaller/Desktop/SLiMgui_CMAKE/SLiMgui_autogen/include/ui_QtSLiMWindow.h:32,
                 from /home/bhaller/Desktop/SLiM/QtSLiM/QtSLiMWindow.cpp:22:
/home/bhaller/Qt/5.14.2/gcc_64/include/QtWidgets/qtextedit.h:203:24: note: declared here
  203 |     QT_DEPRECATED void setTabStopWidth(int width);
      |                        ^~~~~~~~~~~~~~~
GiuseppeD'Angelo

Giuseppe D’Angelo

Senior Software Engineer

Learn Modern C++

Learn more