Closed KRTirtho closed 3 years ago
Amazing work!!!
Dialog & its all inherited widgets can only be used inside a View or BoxView. Using it in other places will not work. It'd cause the Dialog components to not appear.
Can you add a warning log here saying child wasnt rendered because it was used not inside a view or boxview when this happens ?
Currently I don't know any way of accessing parent Component/Widget in react thus determining whether any component was added as a child to a certain type of Component/s isn't possible in that view. But if there's any method/property
of QDialog
that can get the instance of parent widget or anything about parent widget please let me know...
You can take a look at this: https://github.com/nodegui/react-nodegui/blob/master/src/components/TabItem/RNTabItem.ts
But If its too complex for this use case we can go ahead with too.
Well, I looked into that example.. But I've to extend QDialog
to inherit the functionalities but looks like TabItem
isn't a nodegui/qt widget. It is a vanilla widget & was fundamentally created for react-nodegui's Tabs
so inheriting Component
was possible.
If you really want to show a warning log about adding a NodeDialog
instance to the layout tree than you can do so in nodegui's widget.layout.addWidget
, widget.setWidget
or widget.setCentralWidget
. It'd even make it better for the nodegui's part too preventing accidental addition of Dialog as child
Looks like it'd be complicated for the react-nodegui part. So I suggest about going ahead Thanks again @a7ul
@all-contributors add @KRTirtho for code
@a7ul
I've put up a pull request to add @KRTirtho! :tada:
Fixes #108 Added Components:
Edited/Modified:
NodeDialog
inherited widgets)Disclaimer!:
Dialog
& its all inherited widgets can only be used inside aView
orBoxView
. Using it in other places will not work. It'd cause the Dialog components to not appear. This behavior was expected since addingNodeDialog
inherited widgets to Layout or as a child to other widgets doesn't work. Thus filters were added toView
&BoxView
to not let anyinstance
ofNodeDialog
to be added in the layout treeAn working example:
Thanks @a7ul