Tests: Make CMakeGUI test build with both Qt5 and Qt6

Fixes: #26710
5 files changed