[Development] QString and related changes for Qt 6

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue May 12 19:48:24 CEST 2020


On 5/12/20 6:12 PM, Иван Комиссаров wrote:
> So the question is - is it possible to allow to construct QString from unicode literal?

"Not yet", but adding a constructor from char16_t to QString makes sense.

This creates a problem down the line: today you have a

   f(QString)

and you call it with f(u"whatever"). Then, later on, you realize that 
QString is not needed and QStringView suffices. (This is the case all 
over existing Qt code.)

What do you do? Adding a QStringView overload will make calls ambiguous, 
removing the QString one will be an ABI break. We need an established 
solution for these cases as they'll pop up during the Qt 6 lifetime.


Note that adding the QString(char16_t*) constructor introduces this 
ambiguity for the functions that are already overloaded on 
QString+QStringView (and thus today are using QStringView).

Thanks,
-- 
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: 4329 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200512/614ce4b9/attachment.bin>


More information about the Development mailing list