How to use the @nodegui/nodegui.BaseWidgetEvents.KeyRelease function in @nodegui/nodegui

To help you get started, weโ€™ve selected a few @nodegui/nodegui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nodegui / examples / nodegui / calculator / src / index.ts View on Github external
});
  return {
    ui: button,
    value,
    type
  };
};

// Main Window
const win = new QMainWindow();
win.setFixedSize(230, 300);

// Root view
const rootView = new QWidget();
win.addEventListener(
  BaseWidgetEvents.KeyRelease,
  (nativeEvent: NativeElement) => {
    const keyEvt = new QKeyEvent(nativeEvent);
    const text = keyEvt.text();
    const isNotNumber = isNaN(parseInt(text));
    onBtnClick(text, isNotNumber ? "command" : "value");
  }
);
rootView.setObjectName("rootView"); //This is like ids in web world
win.setCentralWidget(rootView);
const rootStyleSheet = `
* {
  font-size: 20px;
  color: white;
}

QPushButton {