Kylin/Fluent/QClassStdStream.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

2023-08-13 15:05:35 +08:00
#include "QClassStdStream.h"
namespace std {
std::ostream &operator<<(std::ostream &stream, const QSize &element) {
stream << "QSize(" << element.width() << "," << element.height() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QPoint &element) {
stream << "QPoint(" << element.x() << "," << element.y() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QPointF &element) {
stream << "QPointF(" << element.x() << "," << element.y() << ")";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QString &element) {
stream << element.toStdString();
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QStringList &element) {
stream << "[";
for (auto &str : element) {
stream << str << ", ";
}
stream << "]";
return stream;
}
std::ostream &operator<<(std::ostream &stream, const QImage::Format &element) {
switch (element) {
case QImage::Format_RGB32:
stream << "Format_RGB32";
break;
case QImage::Format_RGBA8888:
stream << "Format_RGBA8888";
break;
default:
stream << "unknown format: " << (int)element;
break;
}
return stream;
}
} // namespace std