QtExcel / QXlsx

Excel file(*.xlsx) reader/writer library using Qt 5 or 6. Descendant of QtXlsxWriter.
https://qtexcel.github.io/QXlsx/
MIT License
1.16k stars 358 forks source link

Suggest QStringLiteral in xlsxcolor.cpp lines 125 and 134 #180

Closed ransbotham3 closed 2 years ago

ransbotham3 commented 3 years ago

File xlsxcolor.cpp now contains literal strings in lines 125 and 134.

QColor color;
QString strColor = QStringLiteral( "00000000" );

if ( c.length() == 8 )
{
     strColor = c;
}

if ( c.length() == 6 )
{
     strColor = QStringLiteral( "00" ) + c;
}

If changed to use QStringLiteral, I think the code would compile with the QT_NO_CAST_FROM_ASCII option.

Regards

j2doll commented 3 years ago

Dear @ransbotham3

Thanks for reporting.

dantti commented 3 years ago

QLatin1String is a better fit for this, I have fixed this in https://github.com/QtExcel/QXlsx/pull/176