[Development] Copy initialization vs. direct initialization?

Sze Howe Koh szehowe.koh at gmail.com
Thu Mar 26 07:13:36 CET 2026


Does the Qt Project have a preference between the following?

    QVector2D myVector = QVector2D(x, y);

vs.

    QVector2D myVector(x, y);

Context: https://codereview.qt-project.org/c/qt/qtdeclarative/+/642149
used the former;
https://codereview.qt-project.org/c/qt/qtdeclarative/+/724447 copies
the older patch's logic while trying the latter syntax. I plan to make
them consistent with each other, but I don't know which way is
preferred.

https://wiki.qt.io/Qt_Coding_Style and
https://wiki.qt.io/Coding_Conventions don't discuss this.


Regards,
Sze-Howe


More information about the Development mailing list