Add windowStateChanged signal to QWindow

This commit is contained in:
Simon Edwards 2022-08-16 09:53:36 +02:00
parent 79433a5c83
commit 3f0d00c83c
2 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,15 @@ void QWindowWrap::connectSignalsToEventEmitter() {
Napi::Number::New(env, visibility)});
});
QObject::connect(
this->instance.data(), &QWindow::windowStateChanged,
[=](Qt::WindowState windowState) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "windowStateChanged"),
Napi::Number::New(env, windowState)});
});
this->instance->installEventFilter(this);
}

View File

@ -74,6 +74,7 @@ wrapperCache.registerWrapper('QWindowWrap', QWindow);
export interface QWindowSignals extends QObjectSignals {
screenChanged: (screen: QScreen) => void;
visibilityChanged: (visibility: Visibility) => void;
windowStateChanged: (windowState: WindowState) => void;
}
registerNativeWrapFunction('QWindowWrap', (native: any) => {