Add applicationDisplayNameChanged & lastWindowClosed signals to QApplication

This commit is contained in:
Simon Edwards 2023-01-14 10:59:27 +01:00
parent 3a04d14872
commit 4e42f61faa
2 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,14 @@ class DLL_EXPORT NApplication : public QApplication, public EventWidget {
// Qt Connects: Implement all signal connects here
QOBJECT_SIGNALS
QObject::connect(
this, &QGuiApplication::applicationDisplayNameChanged, [=]() {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call(
{Napi::String::New(env, "applicationDisplayNameChanged")});
});
QObject::connect(
this, &QGuiApplication::focusWindowChanged, [=](QWindow* focusWindow) {
Napi::Env env = this->emitOnNode.Env();
@ -25,6 +33,12 @@ class DLL_EXPORT NApplication : public QApplication, public EventWidget {
this->emitOnNode.Call({Napi::String::New(env, "focusWindowChanged")});
});
QObject::connect(this, &QGuiApplication::lastWindowClosed, [=]() {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "lastWindowClosed")});
});
QObject::connect(
this, &QGuiApplication::primaryScreenChanged, [=](QScreen* screen) {
Napi::Env env = this->emitOnNode.Env();

View File

@ -105,7 +105,9 @@ export class QApplication extends QObject<QApplicationSignals> {
wrapperCache.registerWrapper('QApplicationWrap', QApplication);
export interface QApplicationSignals extends QObjectSignals {
applicationDisplayNameChanged: () => void;
focusWindowChanged: () => void;
lastWindowClosed: () => void;
primaryScreenChanged: (screen: QScreen) => void;
screenAdded: (screen: QScreen) => void;
screenRemoved: (screen: QScreen) => void;