You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
@sedwards2009
If I try with cloning the project you linked (even if I don't plan to use typescript on this project) and use the code quote on the docs, it still tells me (in another way than before, though) that a QWidget.layout.addWidget() is not a function...
@Angor-de-Redjak I know your question is a while ago but i think you simply have a little error in your code.
If you look up the typescript sourcecode of QWidget.ts
you can see layout is actualy a getter function and not a property.
Did you try: rootview.layout().addWidget(label);
instead of: rootview.layout.addWidget(label);
yet?
The thing is it is not my code. It's part of a code I linked above which is... On the official nodeGUI doc website 😬
So the official documentation is not up to date :/
It's a little hard to keep track of such a huge project Angor-de-Redjak. I can't remember seeing the original author of NodeGui for quite some time now.
Most if not all work is done by a single person - sedwards2009 - so mistakes happen. It's the nature of the beast! ;)
Back then when https://docs.nodegui.org/docs/guides/layout/#example was written, layout has indeed been a property of QWidget. I remember I had a discussion here about this topic too. It was changed to a getter function around NodeGui version 0.45.0
I'm also a complete beginner on everything related to UI and at that time, I lost several weeks spent of my fan project just because I was blindly following the tutorial part of the documentation. So yeah, I understand that it's a massive task for the author.
But I also come from a place of really intense frustration, especially when a dev-project is the only thing letting you stay afloat on an everyday basis... Anyway!
Activity
Angor-de-Redjak commentedon Mar 15, 2026
Can someone please help me, please?
I'm literally just using the code example on your Doc here and NOTHING ELSE, the example in FlexLayout : https://docs.nodegui.org/docs/guides/layout/#example
And my node gets back to me with this error, I find nothing on the matter online and not even a community that could help me with this...
sedwards2009 commentedon Mar 15, 2026
maybe try this one: https://github.com/sedwards2009/nodegui-simple-starter
Angor-de-Redjak commentedon Mar 16, 2026
@sedwards2009
If I try with cloning the project you linked (even if I don't plan to use typescript on this project) and use the code quote on the docs, it still tells me (in another way than before, though) that a QWidget.layout.addWidget() is not a function...
I also tried using this: https://github.com/scanline/nodegui-simple-starter-js/
Same result as usual. I get an error when I compile the code...
Angor-de-Redjak commentedon May 12, 2026
I finally found a solution. You need to declare a rootLayout outside of the setLayout like this.
The documentation is absolutely not up-to-date. I lost 2 months on my project just because nobody realized that. Won-der-ful
scanline commentedon Oct 7, 2026
@Angor-de-Redjak I know your question is a while ago but i think you simply have a little error in your code.
If you look up the typescript sourcecode of QWidget.ts
nodegui/src/lib/QtWidgets/QWidget.ts
Line 67 in d54943c
you can see
layoutis actualy a getter function and not a property.Did you try:
rootview.layout().addWidget(label);instead of:
rootview.layout.addWidget(label);yet?
Angor-de-Redjak commentedon Oct 7, 2026
Hi Scanline,
You are totally right, indeed!
The thing is it is not my code. It's part of a code I linked above which is... On the official nodeGUI doc website 😬
So the official documentation is not up to date :/
scanline commentedon Oct 8, 2026
It's a little hard to keep track of such a huge project Angor-de-Redjak. I can't remember seeing the original author of NodeGui for quite some time now.
Most if not all work is done by a single person - sedwards2009 - so mistakes happen. It's the nature of the beast! ;)
Back then when https://docs.nodegui.org/docs/guides/layout/#example was written,
layouthas indeed been a property of QWidget. I remember I had a discussion here about this topic too. It was changed to a getter function around NodeGui version 0.45.0Angor-de-Redjak commentedon Oct 8, 2026
I completely understand that!
I'm also a complete beginner on everything related to UI and at that time, I lost several weeks spent of my fan project just because I was blindly following the tutorial part of the documentation. So yeah, I understand that it's a massive task for the author.
But I also come from a place of really intense frustration, especially when a dev-project is the only thing letting you stay afloat on an everyday basis... Anyway!