The problem in your case is that the classes you try to inherit from have different metaclasses:

>>> type(QStandardItem)
<class 'sip.wrappertype'> 
>>> type(ConfigParser)
<class 'abc.ABCMeta'>

Therefore python can't decide which should be the metaclass for the newly created class. In this case, it would have to be a class inheriting from both sip.wrappertype (or PyQt5.QtCore.pyqtWrapperType for older PyQt5 versions) and ABCMeta.

Therefore the metaclass conflict could be resolved by explicitly introducing such a class as metaclass like this:

from PyQt5.QtGui import QStandardItem
from configparser import ConfigParser

class FinalMeta(type(QStandardItem), type(ConfigParser)):
    pass

class FinalClass(ConfigParser, QStandardItem, metaclass=FinalMeta):
    def __init__(self, param):
        ConfigParser.__init__(self)
        QStandardItem.__init__(self)

If you want a more detailed description, this article is a good start.

However I'm not really convinced that using multiple inheritance for this situaction is such a good idea, specially using multiple inheritance together with QObjects can be tricky. Maybe it would be better to just store the ConfigParser object as an instance variable and use that when needed.


You can make your base class's metaclass extends from Qt metaclass system

import abc

from PySide2 import QtWidgets, QtCore


class MixinMeta(type(QtCore.QObject), abc.ABCMeta):
    pass


class MyMixin(object, metaclass=MixinMeta):
    @abc.abstractmethod
    def howToShow(self):
        pass

    def doShow(self):
        self.howToShow()


class MyWidget(QtWidgets.QWidget, MyMixin):
    def howToShow(self):
        self.show()


app = QtWidgets.QApplication()
widget = MyWidget()
widget.doShow()
app.exec_()