Alfie90
Posts: 16
Joined: Mon Dec 30, 2013 3:57 pm

How to install QT?

Mon Feb 10, 2014 6:16 pm

Hi all, I would like to install qt on my pi so I have installed in the terminal and it does not work as it says no valid Qt versions found when I try to make a new project in the application. Please help.
Many thanks

Heater
Posts: 17443
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to install QT?

Mon Feb 10, 2014 10:34 pm

If you have all the correct qt packages install then there should be no problem.

I think the command "sudo apt-get install qt4-dev-tools" should be enough to get what yon need.

If you copy an existing project to your Pi it should build easily if you use qmake first:

Code: Select all

$ qmake
$ make
I don't use qtcreator on the Pi.
Memory in C++ is a leaky abstraction .

Alfie90
Posts: 16
Joined: Mon Dec 30, 2013 3:57 pm

Re: How to install QT?

Tue Feb 11, 2014 5:34 pm

This did not work, it said this was already installed when I typed it in to the terminal. Thanks anyway!

Heater
Posts: 17443
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to install QT?

Wed Feb 12, 2014 8:16 am

Do try to help us to help you.

What did not work exactly?

What was installed already exactly?

Have you tried creating the most simple "Hello world" Qt program and building it ?

Code: Select all

$cd ~/your_project_folder/
$ qmake -project
$ qmake
$ make
Memory in C++ is a leaky abstraction .

shashankt
Posts: 7
Joined: Sat Feb 15, 2014 7:18 pm

Re: How to install QT?

Sun Feb 16, 2014 6:30 am

I am assuming you are using raspbian image.

Installation Steps:

0. Set proper date and time and go for "sudo apt-get update" and "sudo apt-get upgrade"

1. sudo apt-get install qt4-dev-tools

2. sudo apt-get install qtcreator

3. sudo apt-get install gcc
sudo apt-get install xterm
sudo apt-get install git-core
sudo apt-get install subversion
Step 3 is optional but do it anyways.

4.Open Qtcreator and do the following:
Options > build & run > tab tool chain > button add >Choose GCC

Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.6
Debugger : /usr/bin/gdb
Mkspec : default

5. Qt Creator seems to detect that we are going to deploy on a remote target.
To fix this :

Go to menu help > about plugins
Uncheck device support > remote linux
Restart Qt Creator
Go to tools > options TAB > build & run > Qt versions > add “/usr/bin/qmake-qt4”

This is all you need to install qt on raspberry pi. you can then start working on Qtcreator.
However there is a problem that the code u write in Qt does not get built and compiled from the normal build and run button of Qt.. you need to do it from LXTerminal.
Steps for compiling and running:
after you have written all ur code in whatever files (source and headers both).. do "save all" from file menu..
then open LXterminal and make the current directory as the directory where you had opted to save the project files(while starting a new project).
1. qmake -project
2. qmake <yourprojectname>.pro
3. make (//For compilationn of the code)
4. sudo ./<yourprojectname> (//For running the program)

Note: Step 1 and 2 need to be done only once for the first time. No harm if u do it again. Afterwards if u change the code and want to recompile then only "make" command should suffice.

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: How to install QT?

Sun Feb 16, 2014 10:19 am

Hello,
shashankt said:
However there is a problem that the code u write in Qt does not get built and compiled from the normal build and run button of Qt.. you need to do it from LXTerminal
I have the build and run button working on my QT4 setup. Somewhere on this forum there are instructions on how to do this.
I can't find the link at the moment.

edit, found the link:- http://www.raspberrypi.org/phpBB3/viewt ... 31&t=43545

Regards

nipuna.cooray
Posts: 1
Joined: Mon Sep 26, 2016 1:12 pm

Re: How to install QT?

Tue Sep 27, 2016 5:40 am

If anyone is trying to install Qt in a raspberry pi, and develop GUI in rpi, following are the steps that you want to follow in a nutshell
1. Update your raspberry pi -

Code: Select all

sudo apt-get update
2. Upgrade your raspberry pi -

Code: Select all

sudo apt-get upgrade
3. Install Qt - (I have used Qt5) -

Code: Select all

sudo apt-get install qt5-default
4. Install Qt creator -

Code: Select all

sudo apt-get install qtcreator
5. Open Qtcreator and go to Help > about plugins and and untick Remote Linux
6. Restart your raspberry pi
7. Again open Qt creator, go to "Tools > Options > Build and Run" and go to Compilers. Add "GCC" set compiler path as /usr/bin/gcc
8. Normally Qt version and Debugger will be automatically set, but you can also set them
9. Then go to Kits (Still inside the Build and Run) and check whether Compiler, Debugger and Qt version are set
10. That's it , click Ok and create a new project

User avatar
MrWheeliebin
Posts: 8
Joined: Sun Jun 10, 2012 12:13 am
Location: Wheeliebinland

Re: How to install QT?

Wed Sep 27, 2017 9:40 am

Thanks for all this. Can I just add that I got this up from the instructions above but also needed to `sudo apt-get install qtdeclarative5-dev` to get the default Qt apps to build.

Return to “C/C++”