diff options
author | Sergio Martins <iamsergio@gmail.com> | 2018-10-14 17:42:16 +0100 |
---|---|---|
committer | Sergio Martins <iamsergio@gmail.com> | 2018-10-14 17:42:16 +0100 |
commit | bc3249b4591b1c83520a27df28c04f9d57188864 (patch) | |
tree | 39d3d6b57eff790e3a11de00987e06b5822a2672 | |
parent | 2860f3dc6069b600383959563d5c5b475d523014 (diff) |
empty-qstringliteral: Improve readme
QStringLiteral().isNull() is false
-rw-r--r-- | docs/checks/README-empty-qstringliteral.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/docs/checks/README-empty-qstringliteral.md b/docs/checks/README-empty-qstringliteral.md index 3c78ba67..fe8ba4ef 100644 --- a/docs/checks/README-empty-qstringliteral.md +++ b/docs/checks/README-empty-qstringliteral.md @@ -3,4 +3,7 @@ Suggests to use an empty `QString` instead of an empty `QStringLiteral`. The later causes unneeded code bloat. -You should use `QString()` instead of `QStringLiteral()` and use `QString("")` instead of `QStringLiteral("")`. +You should use `QString()` instead of `QStringLiteral()` and `QStringLiteral("")`. + +Note: Beware that `QString().isNull()` is `true` while both `QStringLiteral().isNull()` and `QStringLiteral("").isNull()` are `false`. +So be sure not to introduce subtle bugs when doing such replacements. In most cases it's simply a matter of using `isEmpty()` instead, which is `true` for all cases above. |