Commit 220a1e04 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Add QDebug stream operator for AbstractOutput

This can be useful for debugging purposes.
parent 33ba2974
......@@ -53,6 +53,27 @@ const uint16_t *GammaRamp::blue() const
return m_table.data() + 2 * m_size;
}
QDebug operator<<(QDebug debug, const AbstractOutput *output)
{
QDebugStateSaver saver(debug);
debug.nospace();
if (output) {
debug << output->metaObject()->className() << '(' << static_cast<const void *>(output);
debug << ", name=" << output->name();
debug << ", geometry=" << output->geometry();
debug << ", scale=" << output->scale();
if (debug.verbosity() > 2) {
debug << ", manufacturer=" << output->manufacturer();
debug << ", model=" << output->model();
debug << ", serialNumber=" << output->serialNumber();
}
debug << ')';
} else {
debug << "AbstractOutput(0x0)";
}
return debug;
}
AbstractOutput::AbstractOutput(QObject *parent)
: QObject(parent)
{
......
......@@ -11,6 +11,7 @@
#include <kwin_export.h>
#include <QDebug>
#include <QObject>
#include <QRect>
#include <QSize>
......@@ -210,6 +211,8 @@ private:
int m_directScanoutCount = 0;
};
KWIN_EXPORT QDebug operator<<(QDebug debug, const AbstractOutput *output);
} // namespace KWin
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment