Repository: opencv
Issue: OpenCV does not compile with WITH_QT=6 and WITH_FFMPEG=ON
Labels: category: build/install,incomplete

##### System information (version)

- OpenCV => 4.x, 4.5.5
- Operating System / Platform => Windows 64 Bit
- Compiler => CMake 3.17 / Unix Makefiles

##### Detailed description

I am trying to have opencv compiled with Qt6, and it works, except if I add the WITH_FFMPEG option (which is necessary to avoid an error in my C++ programs)

```
[ 50%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/moc_window_QT.cpp.obj
In file included from D:/Dev/a_installer/opencv-master/compil-mingw/modules/highgui/src/moc_window_QT.cpp:10:
D:/Dev/a_installer/opencv-master/modules/highgui/src/window_QT.h:51:10: fatal error: QGLWidget: No such file or directory
   51 | #include <QGLWidget>
```

I imagine Qt6 is not fully supported yet, but I just wanted to let you know as it is very close to working.
I saw that `QtOpenGL/QGLWidget` is not in Qt6 anymore, which causes the error, but there is no obvious solution or remplacement that I managed to find.

Thank you very much for your help on this matter!

##### Steps to reproduce

```
export Qt6_DIR=${REP_BIB}/qt-6.2.2/6.2.2/mingw_64/                                                                                                    
rm CMakeCache.txt; /c/Program\ Files/CMake-3.17/bin/cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX="${REP_BIB}/opencv4.5.x" -D WITH_TBB=ON -DBUILD_TESTS=OFF -D BUILD_NEW_PYTHON_SUPPORT=OFF -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -D WITH_QT=6 -D WITH_GTK=OFF -D WITH_OPENGL=ON -D WITH_CUDA=ON -D BUILD_opencv_cudacodec=OFF -D WITH_FFMPEG=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -DOGRE_DIR="C:/Program Files/ogre-sdk-v1.12.6-vc15-x64/CMake" -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ -DCMAKE_PREFIX_PATH=${Qt6_DIR} .. && cmake --build .  -j 6 --target install --config release
```

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with forum.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://forum.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->