Warning, /sdk/clazy/docs/checks/README-qcolor-from-literal.md is written in an unsupported language. File is not indexed.
0001 # qcolor-from-literal 0002 0003 Warns when a `QColor` is being constructed from a string literal such as "#RRGGBB". 0004 Next to the constructor call, this includes QColor::setNamedColor and the static QColor::fromString method. 0005 This is less performant than calling the ctor that takes `int`s, since it creates temporary `QString`s. 0006 Also, the pattern is checked in regards to it only containing hexadecimal values and being of a supported length. 0007 0008 ### Fixits 0009 This check provides fixits for #RGB, #RRGGBB and #AARRGGBB patterns. 0010 For QColor object needing more precision, you should manually create a QRgba64 object. 0011 0012 For example: 0013 ``` 0014 testfile.cpp:92:16: warning: The QColor ctor taking RGB int value is cheaper than one taking string literals [-Wclazy-qcolor-from-literal] 0015 QColor("#123"); 0016 ^~~~~~ 0017 0x112233 0018 0019 testfile.cpp:93:16: warning: The QColor ctor taking RGB int value is cheaper than one taking string literals [-Wclazy-qcolor-from-lite 0020 QColor("#112233"); 0021 ^~~~~~~~~ 0022 0x112233 0023 0024 testfile.cpp:92:16: warning: The QColor ctor taking ints is cheaper than one taking string literals [-Wclazy-qcolor-from-literal] 0025 QColor("#9931363b"); 0026 ^~~~~~~~~~~ 0027 0x31, 0x36, 0x3b, 0x99 0028 ```