Developing graphical applications for Raspberry Pi with Qt5

This tutorial shows how to create graphical applications for Raspberry Pi running the Debian Jessie distro using the Qt5 package provided by the official repository.

Before you begin, install VisualGDB 5.1 or later.

  1. Start Visual Studio. Select File->New Project->VisualGDB Linux Project Wizard:01-prjname
  2. On the first page of the wizard select “Application -> Use Qt”:02-qtprj
  3. Then select “Build the project locally” and choose the Raspberry Pi cross-toolchain from the list. If the toolchain is not installed, VisualGDB will install it automatically. Then select your Raspberry Pi connection in the “Deployment computer” field and click the “configure Qt settings” link:03-host
  4. Ensure Qt 5.x is selected and press OK:04-qt5
  5. Press “Finish”. VisualGDB will begin testing your setup. If you have not installed Qt5 on your Raspberry Pi, it will detect it and suggest installing it automatically:05-qtauto
  6. When you click “yes” the Qt installation process will begin. Note that it may take more than 30 minutes to install depending on the speed of your Internet connection:06-qtinst
  7. As the default Raspberry Pi cross-toolchain does not include the Qt binaries, VisualGDB will suggest synchronizing the sysroot to download them. Click “Yes”:07-sysroot
  8. The sysroot synchronization may take a while. Ensure that you are synchronizing all the directories suggested by VisualGDB:08-syncdirs
  9. Once the synchronization is done, your project will be created. Build it by pressing Ctrl-Shift-B: 09-build
  10. Once the build is complete, simply hit F5 to start debugging it or F10 to step into main(). VisualGDB will automatically deploy it and start all the necessary tools:10-stepin
  11. In order to display the Qt windows on your Windows machine, VisualGDB will suggest automtaically installing the XMing server. Proceed with the installation:11-xming
  12. Once the XMing is installed, VisualGDB will launch it automatically and you will see your application’s windows as if it was running locally:12-helloNow that the debugging is working, you can edit the .ui file to change the GUI layout or the .cpp files to change its logic. Each time you want to test your changes, simply hit F5 and VisualGDB will automatically build and deploy your application and will start a debugging session.