How to use the @nodegui/nodegui.QMainWindow 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
) => {
  const button = new QPushButton();
  button.setText(label);
  button.setObjectName(`btn${value}`);
  button.addEventListener(QPushButtonEvents.clicked, () => {
    onBtnClick(value, type);
  });
  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 = `
github nodegui / examples / nodegui / systray / src / index.ts View on Github external
import {
  QKeySequence,
  QApplication,
  QMainWindow,
  QMenu,
  QIcon,
  QSystemTrayIcon,
  QAction
} from "@nodegui/nodegui";
import path from "path";
import { Dock } from "@nodegui/nodegui-os-utils";
const icon = require("../assets/nodegui_white.png");

const win = new QMainWindow();
const trayIcon = new QIcon(path.resolve(__dirname, icon));
const tray = new QSystemTrayIcon();
tray.setIcon(trayIcon);
tray.show();
tray.setToolTip("hello");

const menu = new QMenu();
tray.setContextMenu(menu);

// -------------------
// Quit Action
// -------------------
const quitAction = new QAction();
quitAction.setText("Quit");
quitAction.setIcon(trayIcon);
quitAction.addEventListener("triggered", () => {
github irustm / angular-nodegui / projects / angular-nodegui / src / lib / window.ts View on Github external
constructor() {
    this.window = new QMainWindow();
    this.centralWidget = new QWidget();
    this.centralWidget.setObjectName('myroot');
  }
}
github nodegui / nodegui-starter / src / index.ts View on Github external
import { QMainWindow, QWidget, QLabel, FlexLayout } from "@nodegui/nodegui";

const win = new QMainWindow();
win.setWindowTitle("Hello World");

const centralWidget = new QWidget();
centralWidget.setObjectName("myroot");
const rootLayout = new FlexLayout();
centralWidget.setLayout(rootLayout);

const label = new QLabel();
label.setObjectName("mylabel");
label.setText("Hello");

const label2 = new QLabel();
label2.setText("World");
label2.setInlineStyle(`
  color: red;
`);