[Development] On deprecating functions

Jedrzej Nowacki Jedrzej.Nowacki at qt.io
Tue Mar 5 10:34:16 CET 2019


On Tuesday, March 5, 2019 8:14:00 AM CET Lars Knoll wrote:
> One solution I thought about is to replace the QT_DEPRECATED(_X) macros with
> something that also contains the version (similar to QT_DEPRECATED_SINCE).
> Then the user could define how current he wants to be, and we could set a
> reasonable default going e.g. one LTS back.
> 
> So use something like
> 
> QT_WARN_DEPRECATED(5,13) void myDeprecatedFunction()
> 
> And expand it to wither QT_DEPRECATED or nothing depending on the version
> limit set.

I believe there is also an alternative of making something like that:

  QT_BEGIN_DEPRECATED_SINCE(5, 12, 123)
  ...
  QT_DEPRECATED void foo();
  QT_DEPRECATED void bar();
  ...
 QT_END_DEPRECATED_SINCE(5, 12, 123)


Begin and end of a block would conditionally disable and enable the 
deprecation warning.

I think that QT_WARN_DEPRECATED(5,13) idea is better, but the block version is 
a bit easier from scripting perspective.

Cheers,
  Jędrek




More information about the Development mailing list