Changes QSystemTrayIcon to inherit EventWidget instead of NodeWidget

This commit is contained in:
soonoo 2019-09-25 12:18:57 +09:00
parent 22498953ba
commit c284558886
2 changed files with 12 additions and 5 deletions

View File

@ -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() {

View File

@ -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);
}