Bug 468419

Summary: Add a check that discourages isNull (in favor of isEmpty)
Product: [Developer tools] clazy Reporter: Giuseppe D'Angelo <dangelog>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: REPORTED ---    
Severity: wishlist CC: smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Giuseppe D'Angelo 2023-04-12 11:22:29 UTC
Qt string-like classes feature two similar but different functions: isNull and isEmpty. There are differences between the two, and the differences are subtle; a null string is always empty but an empty string isn't necessarily null (e.g. QString("") is empty but not null). Usage of isNull is almost always questionable.

(One could also extend this to other classes, e.g. QRect, where the null vs. empty semantics are very weird.)