[Interest] QT_DISABLE_DEPRECATED_BEFORE and external headers

Nyall Dawson nyall.dawson at gmail.com
Tue Feb 11 07:32:19 CET 2020


 Hi list,

I've been defining QT_DISABLE_DEPRECATED_BEFORE in one of my projects
to avoid use of deprecated Qt methods (in prep for Qt 6!).
Unfortunately, one of the external libraries in use by my project
(qwt) uses the deprecated QString::null member in a public header. If
I try to bump the DEPRECATED_BEFORE version to 5.9 or later, the
compilation (rightly) breaks when the headers for this library are
imported.

I'm wondering if there's anyway around this so that I can avoid
applying QT_DISABLE_DEPRECATED_BEFORE to these external headers.

As further info:
- QT_DISABLE_DEPRECATED_BEFORE is defined via cmake
(ADD_DEFINITIONS(-DQT_DISABLE_DEPRECATED_BEFORE=0x050800))
- I tried inserting a
#undef QT_DISABLE_DEPRECATED_BEFORE
#include "..."
#def QT_DISABLE_DEPRECATED_BEFORE 0x050800
block around the library includes, but that had no effect and the
compilation block still occurred at the point of the #include

Any tips?

Nyall


More information about the Interest mailing list