color: QDebug implementation

Makes debugging color values easier.
This commit is contained in:
itsmattkc
2020-04-04 04:18:06 +11:00
parent 87b8713b5e
commit 30be89ac2d
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -181,3 +181,9 @@ QColor Color::toQColor() const
return c;
}
QDebug operator<<(QDebug debug, const Color &r)
{
debug.nospace() << "[R: " << r.red() << ", G: " << r.green() << ", B: " << r.blue() << ", A: " << r.alpha() << "]";
return debug.space();
}
+5
View File
@@ -2,6 +2,7 @@
#define COLOR_H
#include <QColor>
#include <QDebug>
#include "common/define.h"
#include "render/pixelformat.h"
@@ -68,4 +69,8 @@ private:
};
QDebug operator<<(QDebug debug, const Color& r);
Q_DECLARE_METATYPE(Color)
#endif // COLOR_H