If the OpenGL context is being created by Qt, you might have to modify Qt’s default OpenGL pixel format before creating the widget. See https://doc.qt.io/qt-5/qglformat.html#setDefaultFormat
Here is some 100% untested code for you to try:
f = QGLFormat()
f.setSampleBuffers(True) # turn on antialiasing
QGLFormat.setDefaultFormat(f)