Posted inRaspberry Pi

Raspberry Qt – Part 5

I’m going to take you down the slow road. First we will get our application running on the Ubuntu development machine and test our cabling. Then we will go through the pain of getting Qt installed and configured on the Pi. I probably should have used a machine with a fresh Ubuntu install. This one was only a few months old, but I had already done quite a bit. QtCreator and a few pieces of Qt were already installed.

qtdeclarative_At any rate, I still had to install some things and flag others for re-install. Look at the images to get an idea. There are plenty of sites telling you how to install Qt on Ubuntu. Follow instructions which match the version you see listed in the repositories.

libqt5_stuffI must say, while I understand the reasoning behind splitting up Qt into many different installation packages I still lament that the desktop distro boys and girls have not taken it upon themselves to create a qt5-devtools.deb. With Qt 4 you installed the devtools package and that got you the creator, verified/installed the c++ compiler as a dependency and basically set you up to build and run a “hello world” type application. If you did not need SQL, a serial port or any other add ons you could quickly get a minimal development environment. Not so with Qt 5. Stuff is scattered. There is a lot of hunt and peck. This issue needs to be addressed. A minimal environment will not work for our application though as we need to use the serial port. You will notice it is in the list of libqt things I installed.

qttoolsThe source for this project has been zipped and available to download as SerialKeypad. I humbly suggest you don’t just grab the code and go. There are things you need to know. If you do unzip the code into a directory and just try to run, QtCreator needs you to open the .PRO file to open the project.

For those who have never used QtCreator it is a pretty amazing IDE. No IDE is perfect because everyone has their own ideas about how it “should” work and features it “should” provide, but this one is pretty sweet. The struggle for a good IDE for C and C++ has been many decades long. Most compiler vendors tried to come up with one. Borland had their Turbo editor which made their products popular for a time. We then moved into products like Instant-C which seems to have flashed and vanished. Now we are somewhat awash with IDEs ranging from free to massively expensive. In the realm of the free ones QtCreator is no slouch.

new_projectTo create a project you must first click on the New Project button on the Welcome screen. You will then be greeted with the dialog shown at the left.

project_locationAfter choosing the type of project you are then asked to choose a project location. Please ignore the yellow line shown in the image. I went back to get this snapshot after I had completed everything.

project_kitOnce we choose a location we choose a kit.

qt5.5.1-errorsSince various things had been done on my system I had some odd looking entries in my kit screen but none were fatal. You can end up in this situation if various things have been installed then re-installed. You will notice the last entry was fine. The others were flagged because of non-unique names.

project_management_summaryFinally you get to your project management summary screen. Until you click Finish you haven’t actually created your project.