Skip to content

Instantly share code, notes, and snippets.

@vinesmsuic
Last active May 14, 2020 06:09
Show Gist options
  • Save vinesmsuic/65df3de61ba56ccd7eb1eec4d053a402 to your computer and use it in GitHub Desktop.
Save vinesmsuic/65df3de61ba56ccd7eb1eec4d053a402 to your computer and use it in GitHub Desktop.
install QT on linux

Main Steps

sudo apt-get install build-essential

sudo apt-get install qtcreator

sudo apt-get install qt5-default

Note: The version you installed is 5.9.5.

Install documentation and examples If Qt Creator is installed thanks to the Ubuntu Sofware Center or thanks to the synaptic package manager, documentation for Qt Creator is not installed. Hitting the F1 key will show you the following message : "No documentation available". This can easily be solved by installing the Qt documentation:

sudo apt-get install qt5-doc

sudo apt-get install qt5-doc-html qtbase5-doc-html

sudo apt-get install qtbase5-examples

Restart Qt Creator to make the documentation available.

To Install Quick Controls or to solve Unknown module(s) in QT: quickcontrols2:

sudo apt-get install qtdeclarative5-dev
sudo apt-get install qtquickcontrols2-5-dev

Install Other versions / Update Qt with CLI

If you want other versions, you might need to install from here.

How to update Qt with CLI on Ubuntu 16.04

Add the PPA

sudo add-apt-repository ppa:beineri/opt-qt-5.11.1-xenial
sudo apt update

Install Qt

sudo apt install qt511-meta-full

Configure the System

There are a couple of choices here depending on whether you want to configure the use of the new Qt version system wide or to the current user.

For system wide, create the following file in location /etc/xdg/qtchooser.

For the current user, create the following file in location ~/.config/qtchooser.

Create a text file in the chosen qtchooser folder named default.conf with the following contents:

/opt/qt511/bin
/opt/qt511/lib

The first line in the file is the path to the Qt binaries and the second is the path to the Qt libraries.

Check the Configuration

qmake -v

If the configuration is working correctly you should see something like:

QMake version 3.1
Using Qt version 5.11.1 in /opt/qt511/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment