New widgets after application begins
I would like an application that draws new widgets according to user input (say, prompt a user where to put a button) but new widgets created after the QApplication runs are not shown.
Is there a way to do this that I'm missing? Is it possible to force widgets to be added, or can I add all the widgets and change their location and visibility? Or should I use a Qgraphicsscene to draw everything, and then try to emulate the functionality of the widgets I want to display?
Re: New widgets after application begins
- Do you allocate those widgets on the heap (with keyword "new")?
- Do you call show() on those dynamically added widgets?
Re: New widgets after application begins
Quote:
Originally Posted by
jpn
- Do you allocate those widgets on the heap (with keyword "new")?
- Do you call show() on those dynamically added widgets?
I'm actually using the python bindings for Qt, but the 'new' widgets are being created the same way that all the 'original' widgets that are created are.
_Should_ one be able to add new widgets during the mainloop?
Re: New widgets after application begins
Quote:
Originally Posted by
petty
_Should_ one be able to add new widgets during the mainloop?
Sure, why not? Can we see your code?
Re: New widgets after application begins
Quote:
Originally Posted by
wysota
Sure, why not? Can we see your code?
Sure, here:
http://putnote.net/203
Its just a quick thing I jimmied up to make sure I hadn't missed anything, but what it does is, calls a function to set up the ui, then another to position a button at 0,0.
It sets up a signal on that button to call the previous button-positioning function and put a new button at 10,10.
As far as I can see, it is getting to put the button down, but it's never seen to be visible.
Thanks,
Petty
Re: New widgets after application begins
Next time please paste the code here on the forum instead of using external sites.
In your bClick() after you add a button you do:
You should call show() on the button, not on the form, because the latter is already visible, so the method will return immediately.