Building PyQt against Qt with OpenGL disabled

John Ehresman jpe at
Fri Oct 2 20:17:39 BST 2020

I ran in a compile time error when building PyQt with sip-build against a custom built Qt with OpenGL disabled.  The error is in a generated QtWidgets file.

I think the issue is that the test for the disabled feature is in QtGui but it also applies to QtWidgets.  Adding the following method to the QtWidgets class in the file seems to work around the problem:
    def generate(self, *args, **kw):
        qtgui = self.project.bindings.get('QtGui')
        if qtgui is not None:
            for feature in ['PyQt_OpenGL', 'PyQt_Desktop_OpenGL']:
                if feature in qtgui.disabled_features:
        return super().generate(*args, **kw)

My Qt build only has a subset of modules so there may be similar problems elsewhere that I didn’t run into.



More information about the PyQt mailing list