[PyQt] Many Sources for a Signal
Nahuel Defossé
nahuel.defosse at gmail.com
Sun Feb 27 22:06:37 GMT 2011
Hi,
we're working in a tabed text editor which uses QtGui's QTabWidget to
display a QPlainText edit for each tab.
We needed to enable or disable some menus depending on the QTextEditor
activity and some other
widgets surrounding the tab widget also need to be updated (for
example, the status bar displays the line
and column number the text cursor is currently placed at).
To obtain a generic way to publish events within the text editor
without knowing possible receivers, we
hacked QApplication.notify method [1] to notify every possible widget
receiving that an event signature in the
widget hierarchy chain stopping at the QMainWindow instance.
In a few words, multiple sources need to send an event to unknown
receivers, but these events have to
be in the context of the QMainWindow widget hierarchy. What do you suggest?
Nahuel
[1] https://github.com/D3f0/prymatex/blob/master/src/prymatex/core/app.py#L259
More information about the PyQt
mailing list