Add QDebug stream operator for AbstractOutput

This can be useful for debugging purposes.
master
Vlad Zahorodnii 4 years ago
parent 33ba2974eb
commit 220a1e0441

@ -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

Loading…
Cancel
Save