[Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Jul 10 16:14:58 CEST 2015


On 2015-07-10 06:37, Smith Martin wrote:
> ok, thanks, G. That explains it. And then there is the further point that it is unwise to use Q_DECLARE_TYPEINFO to declare C to be "good" in this case. What was the reasoning there?

It really depends. The issue with Q_DECLARE_TYPEINFO is that
adding/changing it breaks binary compatibility, so whether fiddling with
Q_DECLARE_TYPEINFO is "unwise" or not really comes down to whether
breaking binary compatibility for your project is "unwise" or not.

Is your project an application with no exported symbols? Is it part of
an application where you tightly control the end product and have no
external users linking to your libraries? Then probably there is no
issue. OTOH if your project is a widely used library, then breaking BC
is almost certainly going to... irritate (to put it mildly) your users.

In terms of adding/changing Q_DECLARE_TYPEINFO for classes *within Qt*,
then you're definitely in "unwise" territory.

HTH,

-- 
Matthew




More information about the Development mailing list