cengels/skywriter

Replace QString creation with QStringLiteral where appropriate

Closed this issue · 0 comments

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

  1. Do not use QStringLiteral() to initialize an empty string. Use QString() instead as it's more efficient.
  2. Do not use QStringLiteral() multiple times with the same contents. QStringLiterals cannot be merged into one, so this will always create multiple QStringLiterals.
  3. Do not use QStringLiteral() as an argument to a function that accepts a char* argument. In those cases, passing a simple quoted string will forego initializing a QString altogether and work with a simple char* instead.