Skip to content

Improve qcolor-from-literal check and provide fixits

Alexander Lohnau requested to merge work/alex/qcolor_fix into master

This takes into account the different patterns and provides a specific fixit or warning. Also, the #RRRGGGBBB color pattern which was previously ignored (10 characters long)

Example output from compiling Kirigami:

/home/user/kde/src/kirigami/src/platform/basictheme_p.h:149:52: warning: The QColor ctor taking RGB int value is cheaper than one taking string literals [-Wclazy-qcolor-from-literal]
    QColor headerAlternateBackgroundColor = QColor{"#eff0f1"};
                                                   ^~~~~~~~~
                                                   0xeff0f1
/home/user/kde/src/kirigami/src/platform/basictheme_p.h:150:38: warning: The QColor ctor taking RGB int value is cheaper than one taking string literals [-Wclazy-qcolor-from-literal]
    QColor headerHoverColor = QColor{"#2196F3"};
                                     ^~~~~~~~~
                                     0x2196F3
/home/user/kde/src/kirigami/src/platform/basictheme_p.h:151:38: warning: The QColor ctor taking RGB int value is cheaper than one taking string literals [-Wclazy-qcolor-from-literal]
    QColor headerFocusColor = QColor{"#93cee9"};
                                     ^~~~~~~~~
                                     0x93cee9

Merge request reports