Fix bug: Don't wrap normal code with #if/#endif
This commit is contained in:
+19
-18
@@ -115,6 +115,25 @@ XlsxColor::operator QVariant() const
|
|||||||
return QVariant(qMetaTypeId<XlsxColor>(), this);
|
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)
|
#if !defined(QT_NO_DATASTREAM)
|
||||||
QDataStream &operator<<(QDataStream &s, const XlsxColor &color)
|
QDataStream &operator<<(QDataStream &s, const XlsxColor &color)
|
||||||
{
|
{
|
||||||
@@ -155,24 +174,6 @@ QDataStream &operator>>(QDataStream &s, XlsxColor &color)
|
|||||||
return s;
|
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
|
#endif
|
||||||
|
|
||||||
} // namespace QXlsx
|
} // namespace QXlsx
|
||||||
|
|||||||
Reference in New Issue
Block a user