62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import {
|
|
QMainWindow,
|
|
QLabel,
|
|
QCheckBox,
|
|
QLineEdit,
|
|
QPushButton,
|
|
QProgressBar,
|
|
QRadioButton,
|
|
FlexLayout,
|
|
QWidget
|
|
} from "./src/lib/index";
|
|
|
|
const win = new QMainWindow();
|
|
|
|
const label = new QLabel();
|
|
label.setText("Hello world 🧙");
|
|
label.setInlineStyle("font-size: 20px;");
|
|
|
|
const checkbox = new QCheckBox();
|
|
checkbox.setText("Check me out?");
|
|
checkbox.setObjectName("check");
|
|
|
|
const lineEdit = new QLineEdit();
|
|
lineEdit.setPlaceholderText("Enter your thoughts here");
|
|
lineEdit.setObjectName("editable");
|
|
|
|
const button = new QPushButton();
|
|
button.setText("Push Push Push!");
|
|
button.setObjectName("btn");
|
|
|
|
const progressbar = new QProgressBar();
|
|
|
|
const radioButton = new QRadioButton();
|
|
radioButton.setText("Roger that!");
|
|
|
|
const rootView = new QWidget();
|
|
rootView.setObjectName("root");
|
|
rootView.setLayout(new FlexLayout());
|
|
if (rootView.layout) {
|
|
rootView.layout.addWidget(label);
|
|
rootView.layout.addWidget(checkbox);
|
|
rootView.layout.addWidget(radioButton);
|
|
rootView.layout.addWidget(lineEdit);
|
|
rootView.layout.addWidget(button);
|
|
rootView.layout.addWidget(progressbar);
|
|
}
|
|
|
|
win.setCentralWidget(rootView);
|
|
win.setStyleSheet(`
|
|
#root {
|
|
flex: 1;
|
|
height: '100%';
|
|
align-items: 'center';
|
|
justify-content: 'space-around';
|
|
}
|
|
`);
|
|
|
|
win.resize(400, 400);
|
|
win.show();
|
|
|
|
(global as any).win = win; // To prevent win from being garbage collected.
|