Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
actionWithSubmenu.setMenu(subMenu);
actionWithSubmenu.setText("Mac Dock");
// ----------------
// Dock Hide/Show
// ----------------
const hideAction = new QAction();
hideAction.setText("hide window");
hideAction.setShortcut(new QKeySequence("Alt+H"));
hideAction.addEventListener("triggered", () => {
win.hide();
});
//-----
const showAction = new QAction();
showAction.setText("show window");
showAction.setShortcut(new QKeySequence("Alt+S"));
showAction.addEventListener("triggered", () => {
win.show();
});
// ----------------------
// Add everything to menu
// ----------------------
menu.addAction(hideAction);
menu.addAction(showAction);
menu.addAction(actionWithSubmenu);
menu.addAction(quitAction);
win.setWindowTitle("NodeGUI Demo");
win.resize(400, 700);
win.show();
showDockAction.setText("show");
showDockAction.addEventListener("triggered", () => {
Dock.show();
});
//-----
subMenu.addAction(hideDockAction);
subMenu.addAction(showDockAction);
actionWithSubmenu.setMenu(subMenu);
actionWithSubmenu.setText("Mac Dock");
// ----------------
// Dock Hide/Show
// ----------------
const hideAction = new QAction();
hideAction.setText("hide window");
hideAction.setShortcut(new QKeySequence("Alt+H"));
hideAction.addEventListener("triggered", () => {
win.hide();
});
//-----
const showAction = new QAction();
showAction.setText("show window");
showAction.setShortcut(new QKeySequence("Alt+S"));
showAction.addEventListener("triggered", () => {
win.show();
});
// ----------------------
// Add everything to menu
// ----------------------
menu.addAction(hideAction);
menu.addAction(showAction);