Add qDebug support for XlsxColor
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QDebug>
|
||||
|
||||
namespace QXlsx {
|
||||
|
||||
@@ -176,4 +177,21 @@ QDataStream &operator>>(QDataStream &s, XlsxColor &color)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, const XlsxColor &c)
|
||||
{
|
||||
if (c.isInvalid())
|
||||
dbg.nospace() << "XlsxColor(invalid)";
|
||||
else if (c.isRgbColor())
|
||||
dbg.nospace() << c.rgbColor();
|
||||
else if (c.isIndexedColor())
|
||||
dbg.nospace() << "XlsxColor(indexed," << c.indexedColor() << ")";
|
||||
else if (c.isThemeColor())
|
||||
dbg.nospace() << "XlsxColor(theme," << c.themeColor().join(QLatin1Char(':')) << ")";
|
||||
|
||||
return dbg.space();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace QXlsx
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace QXlsx {
|
||||
|
||||
class Styles;
|
||||
|
||||
class XlsxColor
|
||||
class Q_XLSX_EXPORT XlsxColor
|
||||
{
|
||||
public:
|
||||
explicit XlsxColor(const QColor &color = QColor());
|
||||
@@ -77,8 +77,12 @@ private:
|
||||
};
|
||||
|
||||
#if !defined(QT_NO_DATASTREAM)
|
||||
QDataStream &operator<<(QDataStream &, const XlsxColor &);
|
||||
QDataStream &operator>>(QDataStream &, XlsxColor &);
|
||||
Q_XLSX_EXPORT QDataStream &operator<<(QDataStream &, const XlsxColor &);
|
||||
Q_XLSX_EXPORT QDataStream &operator>>(QDataStream &, XlsxColor &);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_XLSX_EXPORT QDebug operator<<(QDebug dbg, const XlsxColor &c);
|
||||
#endif
|
||||
|
||||
} // namespace QXlsx
|
||||
|
||||
@@ -180,7 +180,14 @@ FormatPrivate::~FormatPrivate()
|
||||
*/
|
||||
Format::Format()
|
||||
{
|
||||
if (QMetaType::type("XlsxColor") == QMetaType::UnknownType) {
|
||||
//Fix me! Where should we put these register code?
|
||||
qRegisterMetaType<XlsxColor>("XlsxColor");
|
||||
qRegisterMetaTypeStreamOperators<XlsxColor>("XlsxColor");
|
||||
#if QT_VERSION >= 0x050200
|
||||
QMetaType::registerDebugStreamOperator<XlsxColor>();
|
||||
#endif
|
||||
}
|
||||
//The d pointer is initialized with a null pointer
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user