|
|
@ -115,6 +115,25 @@ XlsxColor::operator QVariant() const |
|
|
|
return QVariant(qMetaTypeId<XlsxColor>(), this); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QColor XlsxColor::fromARGBString(const QString &c) |
|
|
|
{ |
|
|
|
Q_ASSERT(c.length() == 8); |
|
|
|
QColor color; |
|
|
|
color.setAlpha(c.mid(0, 2).toInt(0, 16)); |
|
|
|
color.setRed(c.mid(2, 2).toInt(0, 16)); |
|
|
|
color.setGreen(c.mid(4, 2).toInt(0, 16)); |
|
|
|
color.setBlue(c.mid(6, 2).toInt(0, 16)); |
|
|
|
return color; |
|
|
|
} |
|
|
|
|
|
|
|
QString XlsxColor::toARGBString(const QColor &c) |
|
|
|
{ |
|
|
|
QString color; |
|
|
|
color.sprintf("%02X%02X%02X%02X", c.alpha(), c.red(), c.green(), c.blue()); |
|
|
|
return color; |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(QT_NO_DATASTREAM) |
|
|
|
QDataStream &operator<<(QDataStream &s, const XlsxColor &color) |
|
|
|
{ |
|
|
@ -155,24 +174,6 @@ QDataStream &operator>>(QDataStream &s, XlsxColor &color) |
|
|
|
return s; |
|
|
|
} |
|
|
|
|
|
|
|
QColor XlsxColor::fromARGBString(const QString &c) |
|
|
|
{ |
|
|
|
Q_ASSERT(c.length() == 8); |
|
|
|
QColor color; |
|
|
|
color.setAlpha(c.mid(0, 2).toInt(0, 16)); |
|
|
|
color.setRed(c.mid(2, 2).toInt(0, 16)); |
|
|
|
color.setGreen(c.mid(4, 2).toInt(0, 16)); |
|
|
|
color.setBlue(c.mid(6, 2).toInt(0, 16)); |
|
|
|
return color; |
|
|
|
} |
|
|
|
|
|
|
|
QString XlsxColor::toARGBString(const QColor &c) |
|
|
|
{ |
|
|
|
QString color; |
|
|
|
color.sprintf("%02X%02X%02X%02X", c.alpha(), c.red(), c.green(), c.blue()); |
|
|
|
return color; |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} // namespace QXlsx
|
|
|
|