From c284558886a8947a218c1e117d754394ef0523d4 Mon Sep 17 00:00:00 2001 From: soonoo Date: Wed, 25 Sep 2019 12:18:57 +0900 Subject: [PATCH] Changes QSystemTrayIcon to inherit EventWidget instead of NodeWidget --- .../QtWidgets/QSystemTrayIcon/nsystemtrayicon.hpp | 4 ++-- src/lib/QtWidgets/QSystemTrayIcon/index.ts | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cpp/include/nodegui/QtWidgets/QSystemTrayIcon/nsystemtrayicon.hpp b/src/cpp/include/nodegui/QtWidgets/QSystemTrayIcon/nsystemtrayicon.hpp index de09633d7..e822423a6 100644 --- a/src/cpp/include/nodegui/QtWidgets/QSystemTrayIcon/nsystemtrayicon.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QSystemTrayIcon/nsystemtrayicon.hpp @@ -4,10 +4,10 @@ #include "core/NodeWidget/nodewidget.h" #include "napi.h" -class NSystemTrayIcon: public QSystemTrayIcon, public NodeWidget +class NSystemTrayIcon: public QSystemTrayIcon, public EventWidget { Q_OBJECT - NODEWIDGET_IMPLEMENTATIONS(QSystemTrayIcon) + EVENTWIDGET_IMPLEMENTATIONS(QSystemTrayIcon) public: using QSystemTrayIcon::QSystemTrayIcon; //inherit all constructors of QSystemTrayIcon void connectWidgetSignalsToEventEmitter() { diff --git a/src/lib/QtWidgets/QSystemTrayIcon/index.ts b/src/lib/QtWidgets/QSystemTrayIcon/index.ts index 60e63a578..05d037616 100644 --- a/src/lib/QtWidgets/QSystemTrayIcon/index.ts +++ b/src/lib/QtWidgets/QSystemTrayIcon/index.ts @@ -1,13 +1,13 @@ import addon from "../../utils/addon"; import { NodeWidget } from "../QWidget"; -import { BaseWidgetEvents } from "../../core/EventWidget"; +import { EventWidget, BaseWidgetEvents } from "../../core/EventWidget"; import { NativeElement } from "../../core/Component"; import { QIcon } from "../../QtGui/QIcon"; export const QSystemTrayIconEvents = Object.freeze({ ...BaseWidgetEvents, }); -export class QSystemTrayIcon extends NodeWidget { +export class QSystemTrayIcon extends EventWidget { native: NativeElement; constructor(parent?: NodeWidget) { let native; @@ -18,11 +18,18 @@ export class QSystemTrayIcon extends NodeWidget { } super(native); this.native = native; - this.parent = parent; // bind member functions + this.show = this.show.bind(this); + this.hide = this.hide.bind(this); this.setIcon = this.setIcon.bind(this); this.isVisible = this.isVisible.bind(this); } + show() { + this.native.show(); + } + hide() { + this.native.hide(); + } setIcon(icon: QIcon) { this.native.setIcon(icon.native); }