[PyQt] possible to change the central widget in a QMainWindow

Danny Shevitz shevitz at lanl.gov
Wed Aug 11 17:51:04 BST 2010


Howdy,

 

My app is a QMainWindow subclass with a central widget that is a bunch of
radio buttons. The radio button part is 

constructed on the fly from a template file. I would like the user to be
able to change this central widget by reloading

the template file used to construct it.

 

I am familiar with QMainWindow.setCentralWidget. What I am trying to do is
construct a second central widget

and call setCentralWidget a second time. The gui does not update to reflect
the change, although the underlying

data structures do. I tried, calling self.update() on the QMainWindow, but
this had no effect.

 

So, the question is simply, is there a way to change the central widget in a
QMainWindow. (Or is this poor

style, and there is a better design pattern?)

 

thanks,

Danny

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100811/aa367880/attachment.html>


More information about the PyQt mailing list