[Development] QString and related changes for Qt 6

Marc Mutz marc.mutz at kdab.com
Tue May 12 18:39:33 CEST 2020


On 2020-05-12 16:12, Giuseppe D'Angelo via Development wrote:
> On 5/12/20 12:20 PM, Иван Комиссаров wrote:
>>> * Exceptions can be done where significant performance gains can be 
>>> demonstrated and the API will by design not require a copy of the 
>>> data (e.g. XML writer, stream writers, date time handling)
>> Let me disagree here. The decision should be taken on the fact if the 
>> object takes ownership of the string (and thus QString is used) or it 
>> only «looks» into it.
> 
> I agree. This however leaves us with questions regarding the API. E.g.:
> 
> class Attribute {
> public:
>   // OK: takes ownership
>   void addAttribute(const QString &key, const QString &value);

Such code can take QAnyStringView which would be, essentially, 
std::variant<QLatin1StringView, QStringView, QUtf8StringView (, 
char32_t)>.

And while I still think that char[] should be deprecated once we can 
depend on char8_t, for the time being, that would work with "foo" (and 
convert to QUtf8StringView).

Thanks,
Marc


More information about the Development mailing list