Qt5 installation and path configuration

I have installed Qt5 from the Qt5 project site, to the following directory

/opt/Qt5 

I would also like to mention that I had Qt4 installed previously, I have removed all instances of Qt4 through the software center.

Now that I issue designer from the command prompt, the system gives the following error:

designer: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/designer': No such file or directory

What can be done to correct this problem?


Replace Default Qt version paths in:

/usr/lib/x86_64-linux-gnu/qtchooser/default.conf
or in newer releases /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf:

/opt/Qt5/bin
/opt/Qt5/lib

Check:

qtchooser -print-env

Reference: man qtchooser


Proper path to qt default config: /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf


For all of those who didn't uninstal old version and are wondering how to change the qt directory location. The correct way is to export the QT_SELECT variable and add the custom ~/.config/qtchooser/somename.conf file.

This will be a qt installation visible in qtchooser -l under "somename". So that:

 QT_SELECT=somename; qtchooser -print-env 

Will return your custom location. The downside of changing the default.conf is that it might invalidate where your old qt version is found, when I did change it to /some/path, after executing:

QT_SELECT=qt4; qtchooser -print-env

It find the newer version on my path, however with the ~/config/qtchooser/somename.conf the earlier version is intact.

It is mentioned at the end of the man qtchooser help:

FILES /etc/xdg/qtchooser/*.conf System-wide configuration files. Each has two lines, the first is the path to the binaries and the second is the path to the Qt libraries. If a default.conf is provided, the settings from it will be automatically used in case nothing else is selected.

$HOME/.config/qtchooser/*.conf configuration files