Showing posts with label Qt5 on Raspberry Pi/Raspbian. Show all posts
Showing posts with label Qt5 on Raspberry Pi/Raspbian. Show all posts

Saturday, March 19, 2016

Install Qt5/Qt Creator for Raspberry Pi 3/Raspbian Jessie


This post show how to install Qt5 and QtCreator on Raspberry Pi 3 running Raspbian Jessie release 2016-03-18.

install qt5-default and qtcreator:
$ sudo apt-get install qt5-default
$ sudo apt-get install qtcreator

(Actually same as the steps to install on Raspberry Pi 2)

This video show installation remotely from Windows running PuTTY and Xming.


Remark:
The MicroSD used is:
Kingston Micro SDHC 32GB Class 10/U1 (Up to 80MB/s Read)
(KINGSTON SDC10G2/32GB - 80MB/s)



Remark@2017-04-11:
Please also read Jakob Brunhart comments below.


Thursday, March 17, 2016

Qt - Building Performant SDKs for Embedded Devices - feat. Raspberry Pi 2



by QtStudios

Learn how to develop C++/QML applications using Qt Creator IDE, while harnessing the full capabilities of the hardware with targeted cross-compiled build of Qt. This webinar will enable you to get the most out of the devices support out of the box with Qt for Device Creation and create highly performing SDKs for your own device of choice.

During the webinar, we will present:

* An overview of porting to an embedded device
* Highlight the importance of leveraging full hardware acceleration (OpenGL ES, vfp), hardware curser support
* Demonstrate custom Qt Wayland backend implementation for performance improvements
* How to create an integrated Qt SDK for a target device & cross compile Qt conveniently for any device
* Give guidance through the configure requirements required to get a performant version of Qt

We will demonstrate the performance of Qt on a Raspberry Pi 2, which is packaged for both the Rasbian & Arch Linux distributions & shipped with full Qt Creator integration and basic Wayland compositor to leverage OpenGL for hardware acceleration. Find an unparalleled development experience through a step by step process from integrating Qt with, but not limited to, the Raspberry Pi 2 to offloading more computational work on to the Pi hardware to free precious developer resources for ambitious projects.

Over 3 years ago, Qt was integrated on the Raspberry Pi, which included full hardware acceleration (OpenGL ES 2, vfp), hardware cursor support and a custom Qt Wayland backend implementation using Broadcom APIs. Although completed & publicly documented, packaging Qt in an optimal fashion has not been easy for a new user where mesa GL, no floating point unit usage, no Wayland, X11 standardization and on device compilation brings tears to any informed developers' eyes.


Friday, February 26, 2016

Install Qt5/Qt Creator for Raspberry Pi 2/Raspbian Jessie


For Raspbian Jessie, qt5-default (Qt 5 development defaults package) is included in default repository. Here show how to install Qt5 and Qt Creator on Raspberry Pi 2 running frash new Raspbian Jessie, release 2016-02-09.

As my usual practice, update apt repository and firmware:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo rpi-update

Then reboot if need.

Install xrdp, such than I can control Raspberry Pi remotely from Windows, and capture screen action.
$ sudo apt-get install xrdp

install qt5-default and qtcreator:
$ sudo apt-get install qt5-default
$ sudo apt-get install qtcreator


Once installed, you can run Qt Creator from desktop menu:
Menu > Programming > Qt Creator

or, enter the command in LXTerminal:
$ qtcreator

In my test, Qt Creator CANNOT run remotely from Windows using Microsoft Remote Desktop:


It can run locally:


And can run remotely from Windows using Putty/Xming:


As show in the videos, the code cannot be compiled with default setting caused by:
"Qt Creator needs a compiler set up to build. Configure a compiler in the kit options"

To fix it, refer to the above videos.

But, in my test, the compiler option cannot be saved, and I have to correct it every-time running Qt Creator.

Related:
- Same steps to Install Qt5/Qt Creator for Raspberry Pi 3/Raspbian Jessie


Friday, April 17, 2015

Install Qt5 on Raspberry Pi/Raspbian and Hello World


Updated@2016-02-27: 
For Raspbian Jessie, qt5-default (Qt 5 development defaults package) is included in default repository. Refer the updated post "Install Qt5/Qt Creator for Raspberry Pi 2/Raspbian Jessie".

A member mentioned in the post on raspberrypi.org forums that there are "backports" packages of Qt5 you can install.



Edit the file: /etc/apt/sources.list and add:
deb http://twolife.be/raspbian/ wheezy main backports
deb-src http://twolife.be/raspbian/ wheezy main backports

Install the required key:
$sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 2578B775

Then get Qt5 and esoteric requirements installed:
$ sudo apt-get update
$ sudo apt-get install qt5-default qt5-qmake libegl1-mesa libgles2-mesa



Hello World Qt5 on Raspberry Pi/Raspbian (console application)

- Create a directory, for example, named helloworld. And change to it.
- Create a cpp file, named helloworld.cpp.

#include <QCoreApplication>
#include <QDebug>
#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Qt Version %s\n", QT_VERSION_STR);
    QCoreApplication app(argc, argv);
    qDebug() << "Hello Qt5"; 
    return app.exec();
 
}

Make it with Qt5:
$ qmake -project
$ qmake
$ make


Hello World Qt5 on Raspberry Pi/Raspbian (with GUI widgets)

- Create a directory, for example, named helloqt5. And change to it.
- Create a cpp file, named helloqt5.cpp.

#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Qt Version %s\n", QT_VERSION_STR);
 
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello Qt5");
    label->show();
    return app.exec();
}

Make it with Qt5:
$ qmake -project
$ qmake
$ make

Now you have some error reported. Like this:

helloqt5.cpp:(.text.startup+0x1c): undefined reference to `QApplication::QApplication(int&, char**, int)'
helloqt5.cpp:(.text.startup+0x50): undefined reference to `QLabel::QLabel(QString const&, QWidget*, QFlags<Qt::WindowType>)'
helloqt5.cpp:(.text.startup+0x60): undefined reference to `QWidget::show()'
helloqt5.cpp:(.text.startup+0x64): undefined reference to `QApplication::exec()'
helloqt5.cpp:(.text.startup+0x70): undefined reference to `QApplication::~QApplication()'
helloqt5.cpp:(.text.startup+0x84): undefined reference to `QApplication::~QApplication()'


Now open and edit helloqt5.pro, add the line "QT += widgets":

TEMPLATE = app
TARGET = helloqt5
INCLUDEPATH += .

QT += widgets

# Input
SOURCES += helloqt5.cpp


Now re-make the project:
$ qmake
$ make