Print to PDF: AttributeError: 'NoneType' object has no attribute 'getContentsMargins'

How to test?

Run the Bode diagram demo.
Click on "Print" button and save to PDF.

Traceback (most recent call last):
  File "C:\Dev\Libre\PythonQwt\qwt\tests\test_bodedemo.py", line 259, in print_
    renderer.renderTo(self.plot, printer)
  File "C:\Dev\Libre\PythonQwt\qwt\plot_renderer.py", line 321, in renderTo    
    self.render(plot, p, rect)
  File "C:\Dev\Libre\PythonQwt\qwt\plot_renderer.py", line 359, in render      
    left, top, right, bottom = plot.layout().getContentsMargins()
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'getContentsMargins'