QSystemTrayIcon

Create and control system tray icon.

This class is a JS wrapper around Qt's QSystemTrayIcon class

A QSystemTrayIcon provides ability to add and manipulate native system tray icon.

QSystemTrayIcon inherits from EventWidget

Example

const { QSystemTrayIcon, QIcon } = require("@nodegui/nodegui");
const trayIcon = new QIcon(
resolve(__dirname, "some/image/file.png");
);
const tray = new QSystemTrayIcon();
tray.show();
global.tray = tray; // prevents garbage collection of tray

new QSystemTrayIcon(parent?)

  • parent NodeWidget (optional). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.

Static Methods

QSystemTrayIcon can access all the static methods defined in EventWidget

Instance Properties

QSystemTrayIcon can access all the instance properties defined in EventWidget

Instance Methods

QSystemTrayIcon can access all the instance methods defined in EventWidget. Additionally it also has the following instance methods:

trayIcon.show()

Shows the icon in the system tray icon. It calls the native method QSystemTrayIcon: show.

trayIcon.hide()

Hides the system tray icon. It calls the native method QSystemTrayIcon: hide.

trayIcon.setIcon(icon)

Sets the icon of system tray. It calls the native method QSystemTrayIcon: setIcon.

trayIcon.isVisible()

Returns the visibility of icon. It calls the native method QSystemTrayIcon: setIcon.

trayIcon.setToolTip(toolTip)

Sets the tooltip of system tray. It calls the native method QSystemTrayIcon: setToolTip.

  • toolTip string.

trayIcon.setContextMenu(contextMenu)

Sets the specified menu to be the context menu for the system tray icon. It calls the native method QSystemTrayIcon: setIcon.