QMessageHandler#
superqt.utils.QMessageHandler
#
A context manager to intercept messages from Qt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger |
Logger
|
If provided, intercepted messages will be logged with |
None
|
Attributes:
Name | Type | Description |
---|---|---|
records |
list of tuple
|
Captured messages. This is a 3-tuple of:
|
Examples:
>>> handler = QMessageHandler()
>>> handler.install() # now all Qt output will be available at mh.records
>>> with QMessageHandler() as handler: # temporarily install
... ...
>>> logger = logging.getLogger(__name__)
>>> with QMessageHandler(logger): # re-reoute Qt messages to a python logger.
... ...