[Development] Qt UDL operators

Kai Köhne Kai.Koehne at qt.io
Sat Apr 2 16:46:33 CEST 2022


> From: Development <development-bounces at qt-project.org> On Behalf Of Sona Kurazyan
> Sent: Wednesday, March 30, 2022 3:44 PM
> To: Marc Mutz <marc.mutz at qt.io>; development at qt-project.org
> Subject: [Development] Qt UDL operators
>
> [...]
> As you can see, https://codereview.qt-project.org/c/qt/qtbase/+/401604 raised a lot of discussion, and not everyone felt comfortable with deprecating (and later removing) the “q”-prefixed UDLs.
> To summarize the discussion, I see following options:
> 
> 1. deprecate  _qs, _qba, add Qt::StringLiterals::{_s, _ba}, as suggested above (https://codereview.qt-project.org/c/qt/qtbase/+/401308 + https://codereview.qt-project.org/c/qt/qtbase/+/401604)
> 2. keep _qs, _qba, add_qL1 and remove Qt::StringLiterals::_L1 (https://codereview.qt-project.org/c/qt/qtbase/+/402948 + https://codereview.qt-project.org/c/qt/qtbase/+/402950)
> 3. keep _qs, _qba, add _qL1, keep Qt::StringLiterals::_L1, add Qt::StringLiterals::{_s, _ba} (https://codereview.qt-project.org/c/qt/qtbase/+/402948 + https://codereview.qt-project.org/c/qt/qtbase/+/401308)
> 
> I personally prefer the 1st option, but it would be nice to hear more opinions/concerns and decide how to proceed. 

If you use the "Qt Quick Application" wizard in any recent Qt Creator, and selected a Qt 6 version as minimally required version, the generated main.cpp code will contain code like 

  const QUrl url(u"qrc:/myproject/main.qml"_qs);

Deprecating the u""_qs will mean that we break the most basic user 'hello world' projects utilizing this wizard. I therefore think it's too late to deprecate u""_qs any time soon.

My 2 cents,

Kai



More information about the Development mailing list