한국어
오픈소스포럼
 이곳은 다양한 오픈소스 프로젝트를 소개하고 리뷰, 활용 방법을 공유합니다.

NodeGui를 사용하면 JavaScript로 데스크톱 응용 프로그램을 만들 수 있다.

NodeGui는 Qt를 사용하여 Window 및 기타 GUI 요소를 생성한다. Qt C++ 위젯의 기능을 Javascript 세계로 가져온다. 따라서 순수하게 Javascript 만을 사용하여 데스크탑 응용 프로그램을 작성할 수 있다는 장점이 있다. (HTML 등의 언어가 필요치 않음) 또한 다른 Javascript 데스크탑 GUI 솔루션에 비해 메모리 및 CPU 효율성이 매우 뛰어나다. NodeGui로 구축된 Hello World 앱은 20MB 대의 메모리에서 실행된다.

nodegui_app.png

 

Hello World

nodegui/nodegui-starter 리포지토리를 사용하여 빠르게 시작해 볼 수 있다.

 

index.ts

import { QMainWindow, QWidget, QLabel, FlexLayout, QPushButton, QIcon, QSize } from '@nodegui/nodegui';
import logo from '../assets/logox200.png';

const win = new QMainWindow();
win.setWindowTitle("Hello World");
win.resize(400, 200)

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 button = new QPushButton();
button.resize(100, 150)
button.setIcon(new QIcon(logo));

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

rootLayout.addWidget(label);
rootLayout.addWidget(button);
rootLayout.addWidget(label2);
win.setCentralWidget(centralWidget);
win.setStyleSheet(
  `
    #myroot {
      background-color: #009688;
      height: '100%';
      align-items: 'center';
      justify-content: 'center';
    }
    #mylabel {
      font-size: 16px;
      font-weight: bold;
      padding: 1;
    }
  `
);
win.show();

(global as any).win = win;

실행

nodegui_helloworld.png

 

패키징

완성된 앱을 배포하려면 @nodegui/packer를 사용한다.

Hello World 패키징 크기 약 65MB 수준

nodegui_packaging.png

참조:

https://docs.nodegui.org/docs/guides/getting-started/

https://docs.nodegui.org/docs/guides/nodegui-architecture

번호 제목 글쓴이 날짜 조회 수
35 Wayland IVI Extension 간단 리뷰 file makersweb 2019.05.12 2259
34 GDBus 튜토리얼(GDBus tutorial) file makersweb 2019.06.30 10374
33 텔레그램(Telegram) Bot 개발 file makersweb 2019.07.21 5716
32 리눅스에서 SDL2 최신버전 컴파일과 Qt Creator로 개발환경 구성 file makersweb 2019.10.06 3040
31 webOS소개 및 Raspberry Pi 3 에서 실행 file makersweb 2019.10.13 3884
30 도커(docker)설치 및 기본 명령어 makersweb 2019.12.02 483
29 Pluma(C++ Plug-in Management Framework) 튜토리얼 file makersweb 2019.12.07 14012
28 [SDL2 와 OpenGL]윈도우 생성과 2D그래픽 file makersweb 2020.04.11 3076
27 ZeroMQ의 기본 메세지 패턴들 file makersweb 2020.07.31 8525
26 ZeroMQ 비동기 클라이언트/서버 패턴 file makersweb 2020.08.13 1780
25 Qt와 GStreamer 로 작성한 flac 오디오 재생 예제 file makersweb 2020.09.05 1142
24 가볍고 쉬운 임베디드용 그래픽 라이브러리 - LVGL file makersweb 2020.09.16 3363
23 윈도우에서 안드로이드 flutter 프로그래밍 개발환경 구축(with Visual Studio Code) file makersweb 2020.09.16 796
22 GENIVI DLT(Diagnostic Log and Trace) 활용 file makersweb 2020.11.19 8398
21 Dear ImGui, 경량의 C++ 용 GUI 및 Widget 라이브러리 file makersweb 2020.11.28 9090
20 라즈베리파이4에서 openFrameworks 예제 실행 file makersweb 2020.12.13 560
19 Nana, C++용 크로스플랫폼 GUI 라이브러리 file makersweb 2021.01.06 2072
18 라즈베리파이에서 Redis의 Pub/Sub 패턴을 사용하는 Electron 응용프로그램 file makersweb 2021.01.31 682
17 Protocol Buffers 를 이용한 직렬화 with Conan Package Manager file makersweb 2021.02.24 867
16 CANdevStudio 를 사용하여 CAN 네트워크 시뮬레이션 file makersweb 2021.03.09 1720