[PyQt] Newbie QMainWindow tips

Eric Frederich eric.frederich at gmail.com
Thu Sep 16 16:02:04 BST 2010


Trying to get my first PyQt MainWindow application going.
Its going to be to edit multiple [we'll just call them] documents in tabs.
I will have several dockwidgets that need to correspond to the currently
selected tab.

So when the tab changes, or the data within the document changes, several
dockwidgets need to be kept in sync.

Some questions.

1) How do I create static members for these dockwidgets on my subclass of
QMainWindow?
I'd like to do this so I don't have to pass around the actual reference to
an instance of the subclass (just import MyMainWindow at the top and get it
using MyMainWindow.dockWidgetX).
Right now I'm creating them during __init__ of my QMainWindow subclass and
they actually take references to other instance objects but I can re-factor
it to get those things later on.
Is having static members an advisable thing to do?  If not, please tell me a
better way to do it.  Passing around instances of the main window seems like
its wrong to me, but again, I'm a newbie.

2) What is a good strategy for keeping the dock widgets in sync?

Thanks,
~Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100916/16cfa5ac/attachment-0001.html>


More information about the PyQt mailing list