If you set the preferred number of samples using QSurfaceFormat::setSamples() and run the application with Software OpenGL on Windows, then the application crashes with
int __cdecl GDI::choosePixelFormat(struct HDC__ *,const class QSurfaceFormat &,const struct QWindowsOpenGLAdditionalFormat &,struct tagPIXELFORMATDESCRIPTOR *): Attempted to use GDI functions with a non-opengl32.dll library
QWindowsGLContext::QWindowsGLContext: Unable find a suitable pixel format.
QOpenGLWidget: Failed to create context
QOpenGLFunctions created with non-current context
ASSERT: "QOpenGLFunctions::isInitialized(d_ptr)" in file c:\work\build\qt5_workdir\w\s\qtbase\include\qtgui\../../src/gui/opengl/qopenglfunctions.h, line 1058
This problem came up when an application with dynamic loading of graphics driver was run in an environment with only software OpenGL.
The attached simplified example application reproduces the problem.