File: README-empty-qstringliteral.md

package info (click to toggle)
clazy 1.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,248 kB
  • sloc: cpp: 23,552; python: 1,450; xml: 450; sh: 237; makefile: 45
file content (9 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
# empty-qstringliteral

Suggests to use `QLatin1String("")` instead of `QStringLiteral()` and `QStringLiteral("")`.
`QStringLiteral` should only be used where it would reduce memory allocations.

Note that, counterintuitively, both `QStringLiteral().isNull()` and `QStringLiteral("").isNull()` are `false`,
so do use exactly `QLatin1String("")` and not `QLatin1String()`, in both cases.

If in your code `isNull()` and `isEmpty()` are interchangeable, then simply use `QString()`.