In Ubuntu 22.04 there is currently an open bug QtChooser doesnt support
qt6.
So even if Qt6 has been installed using sudo apt install qt6-base-dev, qtchooser -l does not list a
qt6 option and qmake outputs qmake: could not find a Qt installation of ''.
Assuming Qt6 is installed and qmake6 can be called, I believe there are two options:
1. Select Qt6 system-wide
Generate qt6.conf based on the path to qmake6
qtchooser -install qt6 $(which qmake6)
Move qt6.conf to system-wide dir
sudo mv ~/.config/qtchooser/qt6.conf /usr/share/qtchooser/qt6.conf
Set Qt6 as default option
sudo mkdir -p /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser
sudo ln -n /usr/share/qtchooser/qt6.conf /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser/default.conf
2. Select Qt6 for current user only
Generate qt6.conf based on path to qmake6
qtchooser -install qt6 $(which qmake6)
Select Qt6 as default (place in ~/.bashrc for persistence):
export QT_SELECT=qt6