mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-28 18:24:17 -05:00
Went through and found all QObject subclasses that didn't have a Q_OBJECT macro.
41 lines
781 B
C++
41 lines
781 B
C++
#pragma once
|
|
|
|
#include <widgets/OBSQTDisplay.hpp>
|
|
|
|
#include <QObject>
|
|
#include <QPlatformSurfaceEvent>
|
|
|
|
class SurfaceEventFilter : public QObject {
|
|
Q_OBJECT
|
|
|
|
OBSQTDisplay *display;
|
|
|
|
public:
|
|
SurfaceEventFilter(OBSQTDisplay *src) : QObject(src), display(src) {}
|
|
|
|
protected:
|
|
bool eventFilter(QObject *obj, QEvent *event) override
|
|
{
|
|
bool result = QObject::eventFilter(obj, event);
|
|
QPlatformSurfaceEvent *surfaceEvent;
|
|
|
|
switch (event->type()) {
|
|
case QEvent::PlatformSurface:
|
|
surfaceEvent = static_cast<QPlatformSurfaceEvent *>(event);
|
|
|
|
switch (surfaceEvent->surfaceEventType()) {
|
|
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
|
|
display->DestroyDisplay();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
};
|