[Development] [Interest] Need help with deprecated QVariant functions

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Feb 22 21:38:55 CET 2019


Howdy,


Il 21/02/19 21:09, Christian Ehrlicher ha scritto:
> Hi,

Redirecting the discussion to development at ...


> the two functions qVariantFromValue() and qVariantSetValue() are
> deprecated but the replacements QVariant::setValue() / fromValue() are
> using exactly those two functions...
> Those two functions are some of the last obsolete functions which did
> not yet get decorated with QT_DEPRECATED but since this is affects a
> major class of Qt I don't think it's a task for me.

Could it simply be possible to move the implementation of 
qVariantSetValue to QVariant::setValue, and then have the former call 
the latter, instead of viceversa?

IIRC, the reason for qVariantSetValue is to work around VS2005 not 
supporting member function templates.


> So can someone please take a look on this and mark the two functions as
> deprecated so they can be safely removed with Qt6?
> 
> 
> The other three functions I found in qtcore and are not yet decorated
> with QT_DEPRECATED are:
>    - QByteArray::operator const char *() const (the last idea was to
> un-deprecate this function)

Mixed feelings. I don't like decay-to-pointer, and so doesn't modern C++ 
(e.g. std::array). What's really, really, really, really missing is 
operator std::string_view(). (And, support for std::size / std::data, so 
that std::span works out of the box).


>    - QByteArray::operator const void *() const

This should just go. This is C++, not C.


>    - QLineF::angle(const QLineF &line) const (is QLineF::angleTo() the
> correct replacement?)

Probably -- angle is a bad naming choice.


>    - QLocale::countriesForLanguage(Language language)
>    - QMetaProperty::isEditable(const QObject *object) const (don't know
> why this is deprecated/what's the replacement)

Good question... is this for QML?


> btw: the examples can now be compile with QT_NO_FOREACH :)

Yay, thanks :)


Cheers,
-- 
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/20190222/8069b4b1/attachment.bin>


More information about the Development mailing list