[Development] Deprecated functions / procedure of removal in Qt6?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Mon Oct 22 00:14:16 CEST 2018


Hi,

Il 21/10/18 19:59, Christian Ehrlicher ha scritto:
> there are a lot of deprecated functions in qtbase which are only marked
> as deprecated/obsolete in the documentation but don't have a
> Q_DECL_DEPRECATED. Most of them were deprecated in the pre Qt5-era.
> What's the 'correct' way to make sure they can be removed with Qt6? Must
> they marked as QT_DEPRECATED_SINCE(5,x) or is the comment in the
> documentation enough?

The documentation comment is enough for us to justify the removal -- in 
other words, "formally", we have informed the user to move away, and the 
rule is that we can drop deprecated functions any time we want to break 
source compatibility.


However, it's nowhere enough to

1) make users _aware_ of the fact that they're using deprecated APIs;
2) make us _remember_ to remove those functions when we have the chance 
(like in Qt 6).

Thus, adding deprecation warnings is definitely the right thing to do: 
users get the deprecation warnings (*), and we have an easy way to find 
and drop all those functions.

The other ways to achieve 2) at the moment are:

* If possible, all the code to be killed in Qt 6 should already be 
protected via

>  #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)


* Add some comment in the source code like

// ### Qt 6: remove this


Both ways are more general and apply to functions we can't just 
deprecate or remove (f.i., marking an overload to be merged with another 
one via a default argument, getting rid of useless special member 
function declarations, and the like).

Of course, simply leaving a comment requires us to remember find those 
usages and act on those, and the code is still full of such TODOs for Qt 
5...


(*) I don't like that the deprecation warnings are opt-in and not 
opt-out. People deserve to know as soon as possible that they're using 
deprecated functionality, rather than have a gigantic unpleasant 
surprise ("you're using lots of deprecated stuff that got removed!") 
when Qt 6 comes.


My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20181022/2c9d648f/attachment.bin>


More information about the Development mailing list