Replace QString creation with QStringLiteral where appropriate
Closed this issue · 0 comments
cengels commented
The QStringLiteral macro creates a statically known string during compile time and should therefore be preferred if it does not contain any dynamic information.
Rules
- Do not use
QStringLiteral()
to initialize an empty string. UseQString()
instead as it's more efficient. - Do not use
QStringLiteral()
multiple times with the same contents. QStringLiterals cannot be merged into one, so this will always create multiple QStringLiterals. - Do not use
QStringLiteral()
as an argument to a function that accepts achar*
argument. In those cases, passing a simple quoted string will forego initializing aQString
altogether and work with a simplechar*
instead.