Beginner question about Node-GUI

Open
#1,085 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
javascript, node.js
Domain
desktop

Research direction

Start by reproducing the inline CommonJS example from main() with NodeGUI 0.74.0 and compare its layout access with the API or tutorial referenced in the report. No repository file or test is named; completion would be a confirmed minimal working example or a documented correction to the reported layout usage.

Written by the indexing model from the issue text.

Description

Describe the bug
I keep getting rootview.layout.addWidget and I do not understand why when I'm reading the API...

Sample of my code

const { 
	QMainWindow,
	QWidget, 
	QLabel, 
	QLayout,
	QPushButton, 
	QIcon, 
	QBoxLayout, 
	Direction, 
	FlexLayout
} = require("@nodegui/nodegui");
const path = require("path");

function main() {
	const rootview = new QWidget();
	rootview.setLayout(new FlexLayout());
	rootview.setObjectName("rootView");

	const label = new QLabel();
	label.setObjectName("label");
	label.setText("Import");

	const view = new QWidget();
	view.setObjectName("view");
	rootview.layout.addWidget(label);

	const win = new QMainWindow();
	win.setWindowTitle("Playlist Music TTRPG Manager");
	win.resize(1400, 1000);
	win.show();
	global.win = win;
}
main();

end of the code

Expected behavior
I'm just trying to complete basic tutorial since a week ago and I'm still stuck on the matter.
Do I lack something in my code for it to be recognize a XXX.layout.addWidget() as a function?

Please don't tell me it's because I'm coding in commonJS and it only works with typescript...

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: W10
  • NodeGUI version 0.74.0
  • OS Version 22H2 KB5075912

Additional context
Hi, first time trying to dev a GUI and I'm trying with nodegui. I was looking for a discord nodegui dev-based community, but couldn't find one. Hence me making an issue for what's probably the easiest thing you'll ever see here.
But I'm seriously losing hope here, so if somebody is able to help me, I'll gladly take it...

Dominant language
C++
Stars
9.2k
Forks
315
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nodegui/nodegui

All issues in nodegui/nodegui

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.