You can see that the triangle has jagged edges. That's because of the aliasing effect. You can counter it by enabling multisampling for the window, which will make OpenGL render the contents as if the screen had higher resolution and then average the result, which acts as anti-aliasing. To do that, add the following code to the constructor of the window:
QSurfaceFormat fmt = format(); fmt.setSamples(16); // multisampling set to 16 setFormat(fmt);