<div dir="ltr">Hi Alexander,<div><br></div><div>(forwarding to qgis-dev list, as I think it should be also referenced there)<br><div><br></div><div>Here is the reply I got from Phil:</div><div><br></div><div>> <span style="font-size:13px;color:rgb(33,33,33)">I can confirm it is a bug, however the fix is non-trivial so it won't get fixed quickly. The fundamental problem is that the code has the assumption that all custom widgets will reside in the PyQt5 package hard-coded (but even then it's </span><span class="inbox-inbox-lG" style="font-size:13px;background-color:rgba(251,246,167,0.5);outline:transparent dashed 1px;color:rgb(33,33,33)">not</span><span style="font-size:13px;color:rgb(33,33,33)"> quite as simple as that).</span></div><div><span style="font-size:13px;color:rgb(33,33,33)"><br></span></div><div><span style="font-size:13px;color:rgb(33,33,33)">He also wrote it's on his todo list in the next 3-4 weeks on that time, but I don't think it has been solved.</span></div><div><span style="font-size:13px;color:rgb(33,33,33)"><br></span></div><div><span style="font-size:13px;color:rgb(33,33,33)">Best wishes,</span></div><div><span style="font-size:13px;color:rgb(33,33,33)">Denis</span></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 30 août 2018 à 08:35, Alexander Bruy <<a href="mailto:alexander.bruy@gmail.com" target="_blank">alexander.bruy@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
usually I use following code to create a form from the Qt Designer's .ui<br>
file dynamically<br>
<br>
from PyQt5 import uic<br>
FORM_CLASS, BASE_CLASS = uic.loadUiType('/path/to/ui/file.ui')<br>
<br>
class MyDialog(BASE_CLASS, FORM_CLASS):<br>
    def __init__(self, parent=None):<br>
        super(MyDialog, self).__init__(parent)<br>
        self.setupUi(self)<br>
<br>
and everything works fine.<br>
<br>
But seems this approach seems does not work with multiple inheritance.<br>
There is a custom dialog class (QDialog subclass with custom UI and some<br>
logic) available in the API library. I want to subclass this custom dialog<br>
and also apply my own UI to it. I tried following code<br>
<br>
from PyQt5 import uic<br>
from api.ui import CustomDialogBase<br>
<br>
FORM_CLASS, BASE_CLASS = uic.loadUiType('/path/to/ui/file.ui')<br>
<br>
class MyDialog(BASE_CLASS, CustomDialogBase, FORM_CLASS):<br>
    def __init__(self, parent=None):<br>
        super(MyDialog, self).__init__(parent)<br>
        self.setupUi(self)<br>
<br>
But this raises type error<br>
<br>
TypeError: Cannot create a consistent method resolution order (MRO)<br>
for bases QDialog, QgsOptionsDialogBase, Ui_OptionsDialog<br>
<br>
As I understand, this is because all classes have the same base class QDialog.<br>
<br>
Also I tried to specify only one parent class — custom dialog, as it is<br>
already subclassed from QDialog<br>
<br>
from PyQt5 import uic<br>
from api.ui import CustomDialogBase<br>
<br>
FORM_CLASS, BASE_CLASS = uic.loadUiType('/path/to/ui/file.ui')<br>
<br>
class MyDialog(CustomDialogBase, FORM_CLASS):<br>
    def __init__(self, parent=None):<br>
        super(MyDialog, self).__init__(parent)<br>
        self.setupUi(self)<br>
<br>
But this also does not work, with the error<br>
<br>
AttributeError: 'MyDialog' object has no attribute 'groupBox'<br>
<br>
As I understand, in this case issue is that FORM_CLASS is a QDialog subclass,<br>
not CustomDialogBase's subclass. After some searching I have found this<br>
thread<br>
<a href="https://riverbankcomputing.com/pipermail/pyqt/2017-October/039647.html" rel="noreferrer" target="_blank">https://riverbankcomputing.com/pipermail/pyqt/2017-October/039647.html</a>.<br>
Am I right that currently the only way to solve my issue is to construct<br>
form from the compiled .ui file?<br>
<br>
Thanks<br>
<br>
-- <br>
Alexander Bruy<br>
_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">





<p class="inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:10pt">Denis Rouzaud</span><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><a href="mailto:denis@opengis.ch" target="_blank" style="font-family:Times;font-size:medium"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt">denis@opengis.ch</span> </a><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a>+41 76 370 21 22</a></span></p><p class="inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a><br></a></span></p></div></div>