[PyQt] UIC loader fails on Qt submodules classes

Giuseppe Corbelli corbelligiuseppe at mesdan.it
Wed Dec 13 16:44:27 GMT 2017


Hi all
I am using a QChartView in Qt Charts module and related designer plugin. 
The designer reports the item as QtCharts::QChartView, and apparently 
the namespace is used in other Qt modules too, so I'm assuming this is 
the right way to go.

PyQt 5.9.2 cannot load such objects (and I expect other submodules 
objects too) because:
1) The widget-plugins/qtcharts.py takes care of QChartView while it 
should also manage QtCharts.QChartView
2) The _ModuleWrapper::search has a comment regarding the support for 
namespaces but it tries a getattr without catching AttributeError. In 
this case it would search QtCharts first (and fail), so the 
straightforward solution is to catch the exception and go on with the 
getattr cycle down the namespace list.

I can submit a patch but it's really braindead stuff and I don't know if 
the AttributeError was not caught on purpose.

Attached two simple files to demonstrate the problem.
-- 
Giuseppe Corbelli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChartView.py
Type: text/x-python
Size: 94 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20171213/7546f3e1/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChartView.ui
Type: application/x-designer
Size: 1179 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20171213/7546f3e1/attachment.bin>


More information about the PyQt mailing list