07-21-2012 08:45 PM
I want to add a button to a Container when another button is pressed.
How do I create the button? .create doesn't work , neither does new Button.
Is this possible?
Solved! Go to Solution.
07-22-2012 04:44 AM
There's no dynamic creation in QML.
However you can create the container with the button then just hide it with the visibility or opacity properties and show it again when your button is pressed. The cookbook example is useful for showing how this works.
07-22-2012 11:18 AM
07-22-2012 11:24 AM - edited 07-22-2012 11:25 AM
Or create Q_INVOKABLE method (let's say foo()) inside C++ code. Then put the object of class containing that method into context under specific name (again foo). Then call that method foo.foo() in onClicked signal.
In C++ you are capable of calling insert and other Container's metods too that are not Q_INVOKABLE.