Is there a way to create a tableview inside a button click event?
-
wrote on 23 May 2022, 09:33 last edited by
-
wrote on 23 May 2022, 09:50 last edited by NYBL
Im not sure what are you trying to achieve but you cant create objects like this with java script... (since button handlers are js functions and are not evaluated as qml code) , consider using a loader and a check-able button
so that when the button is checked you set the loader visible or not visible (though you dont need a loader for that) or change the source component
somthing like this:Item{ Button{id: someButton } Loader{ visible: someButton.checked sourceComponent:TableVIew{...} } }
Also you might want to read this https://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html
1/2