-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
34 lines (25 loc) · 755 Bytes
/
test.js
File metadata and controls
34 lines (25 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const qt = require('./build/Release/node-qt.node');
// Create a new application
const app = new qt.QApplication();
// Create a window
const window = new qt.QWidget();
window.setWindowTitle("Hello from Qt!");
window.resize(300, 200);
// Create a vertical layout
const layout = new qt.QVBoxLayout();
window.setLayout(layout);
// Create a label
const label = new qt.QLabel("Hello, World!");
layout.addWidget(label);
// Create a button
const button = new qt.QPushButton("Click me!");
layout.addWidget(button);
// Create a text input
const input = new qt.QLineEdit();
layout.addWidget(input);
// Show the window
window.show();
// Start the event loop
app.exec();