forked from quickshell/quickshell
screens: add qDebug<< impl to QuickshellScreenInfo
This commit is contained in:
parent
fc93591cab
commit
15cd78e30c
|
@ -109,3 +109,21 @@ void QuickshellScreenInfo::screenDestroyed() {
|
||||||
this->screen = nullptr;
|
this->screen = nullptr;
|
||||||
this->dangling = true;
|
this->dangling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const QuickshellScreenInfo* screen) {
|
||||||
|
if (screen == nullptr) {
|
||||||
|
debug.nospace() << "QuickshellScreenInfo(nullptr)";
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.nospace() << screen->metaObject()->className() << '(' << static_cast<const void*>(screen)
|
||||||
|
<< ", screen=" << screen->screen << ')';
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QuickshellScreenInfo::toString() const {
|
||||||
|
QString str;
|
||||||
|
QDebug(&str) << this;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <qdebug.h>
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
|
#include <qqmlinfo.h>
|
||||||
#include <qqmlintegration.h>
|
#include <qqmlintegration.h>
|
||||||
#include <qscreen.h>
|
#include <qscreen.h>
|
||||||
|
#include <qtclasshelpermacros.h>
|
||||||
#include <qtmetamacros.h>
|
#include <qtmetamacros.h>
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
|
|
||||||
|
@ -55,6 +58,8 @@ public:
|
||||||
[[nodiscard]] Qt::ScreenOrientation orientation() const;
|
[[nodiscard]] Qt::ScreenOrientation orientation() const;
|
||||||
[[nodiscard]] Qt::ScreenOrientation primaryOrientation() const;
|
[[nodiscard]] Qt::ScreenOrientation primaryOrientation() const;
|
||||||
|
|
||||||
|
[[nodiscard]] Q_INVOKABLE QString toString() const;
|
||||||
|
|
||||||
QScreen* screen;
|
QScreen* screen;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -71,3 +76,5 @@ signals:
|
||||||
private slots:
|
private slots:
|
||||||
void screenDestroyed();
|
void screenDestroyed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const QuickshellScreenInfo* screen);
|
||||||
|
|
Loading…
Reference in a new issue