Changes between Initial Version and Version 1 of qt


Ignore:
Timestamp:
11/01/2019 10:10:16 PM (3 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • qt

    v1 v1  
     1= Qt For Embedded Linux
     2On Embedded Linux systems there are multiple 'platform plugins' that can be used for backend display such as EGLFS, LinuxFB, DirectFB, or Wayland. The availability of these plugins depends on how Qt is configured. Note that as of Qt 5.0 Qt no longer has its own window system (QWS) implementation as for single-process use cases the Qt Platform Abstraction is a superior solution. If you need support for a multi-process compositing window manager use the Wayland platform plugin and run a Wayland server.
     3
     4List platform plugins:
     5{{{#!bash
     6ls /usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms
     7}}}
     8
     9The platform plugin is specified in one of two ways:
     10 * running app with '-platform <platform>' cmdline options
     11 * defining QT_QPA_PLATFORM env variable
     12
     13[=#eglfs]
     14== EGLFS
     15EGL is an interface between OpenGL and the native windowing system. EGLFS is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system like X11 or Wayland.
     16
     17EGLFS is the default plugin on many boards and is recommended for Embedded Linux devices that include a GPU. You can use the QT_QPA_PLATFORM env variable or the {{{-platform}}} command-line argument to request another plugin.
     18
     19EGLFS forces the first top-level window (either a QWidget or a QQuickView) to become full screen and chosen to be the root widget window into which all other top-level widgets are composited. There are a number of env variables that can be used to configure EGLFS: see https://doc.qt.io/qt-5/embedded-linux.html#eglfs
     20
     21To use the EGLFS platform plugin with a KMS/DRM backend you need to define a screen configuration file customized to your board and display. For a Gateworks Ventana board with 1080p HDMI the configuration would be:
     22{{{#!bash
     23cat << EOF > ventana.json
     24{
     25  "device": "/dev/dri/card1",
     26  "hwcursor": false,
     27  "pbuffers": true,
     28  "outputs": [
     29    {
     30      "name": "HDMI-A-1",
     31      "mode": "1920x1080"
     32    },
     33    {
     34      "name": "LVDS-1",
     35      "mode": "off"
     36    }
     37  ]
     38}
     39EOF
     40export QT_QPA_EGLFS_KMS_CONFIG=$PWD/ventana.json
     41export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
     42export QT_QPA_PLATFORM=eglfs
     43}}}
     44
     45In order to use EGLFS you need to be using a kernel with the etnaviv KMS/DRM driver enabled, libdrm (userspace lib to interface with Linux DRM drivers), and libmesa. Note that the etnaviv driver uses cma memory - if you get memory allocation errors when trying to run applications try increasing the cma memory via the kernel command-line.
     46
     47
     48[=#linuxfb]
     49== LinuxFB
     50LinuxFB writes directly to the framebuffer via Linux's fbdev subsystem where only software-rendered content is supported (no hw acceleration). Note that the fbdev subsystem is being deprecated in the Linux kernel and the DRM dub buffer support is to take its place and is supported in Qt 5.9. To use it set QT_QPA_FB_DRM=1. This provides a double-buffered and page flipped output providing proper vsync for software-rendered content. For env variables and options see https://doc.qt.io/qt-5/embedded-linux.html#linuxfb
     51
     52{{{#!bash
     53export QT_QPA_PLATFORM=linuxfb
     54}}}
     55
     56
     57= Qt Examples
     58
     59[=#qtwebegine]
     60== !QtWebEngine
     61!QtWebEngine is essentially the Chromium core wrapped in Qt making it possible to render web content even without X11/Wayland and it works just fine with pure framebuffer.
     62
     63A simple example using !QtWebEngine can be found at https://code.qt.io/cgit/qt/qtwebengine.git/tree/examples/webengine/minimal
     64
     65To build the simple example which creates a !QtWebEngine fullscreen widget using content from http://www.qt.io:
     66 * Ubuntu Eoan 19.10:
     67{{{#!bash
     68apt update && apt upgrade # always a good idea to keep up to date
     69# install basic development requirements
     70apt install build-essential git
     71# install qt5 development packages
     72apt install qtwebengine5-dev
     73# install qt5 runtime
     74apt install qt5-default qml-module-qtwebengine
     75# install qtwebengine minimal code example
     76apt install qtwebengine5-examples
     77cd /usr/lib/arm-linux-gnueabihf/qt5/examples/webengine/minimal
     78# edit main.qml if you want to change the width/height or url
     79qmake # generate Makefile from *.pro
     80make # build
     81./minimal --no-sandbox
     82}}}
     83
     84Note that the QtWebEngine package in Ubuntu bionic 18.04 is only built with X11 platforms support and thus will not run on linuxfb or eglfs.
     85
     86== Qt5 Cinematic Experience
     87This UX demo application presents some graphical features of Qt5. The name 'Cinematic Experience' reflects how it's possible to build user interfaces with increased dynamics.
     88
     89Examples:
     90 * Ubuntu Bionic 18.04:
     91{{{#!bash
     92apt update && apt upgrade # always a good idea to keep up to date
     93# install basic development requirements
     94apt install build-essential git
     95# install qt5 runtime
     96apt install qt5-default qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-particles2
     97# install qt5 development packages
     98apt install qtbase5-dev qtdeclarative5-dev
     99git clone https://github.com/rzr/qt5-cinematic-experience
     100cd qt5-cinematic-experience
     101qmake
     102make
     103./Qt5_CinematicExperience
     104}}}
     105
     106== Qt GL Video Demo
     107This UX demo application shows how to render video frames on 3D objects which in turn are integrated in a Q graphical features of Qt5. The name 'Cinematic Experience' reflects how it's possible to build user interfaces with increased dynamics.
     108
     109The video frames are produced by the GStreamer !GstPlayer library. They are uploaded into OpenGL textures, which are then used on 3D meshes. These meshes are rendered in QQuickFramebufferObject !QtQuick 2 items, and the items are composed by a !PathView on screen. The 3D objects can be rotated with the mouse or with touch events. UI controls allow for adjusting several parameters such as opacity, scale, mesh type, etc. and for adding/removing objects. The video frames can come from local video files, network streams, or Video4Linux2 based video capture devices.
     110
     111Subtitles can be shown on screen. The subtitles can come either from the playing media itself, or from a FIFO if one is enabled in the configuration file.
     112
     113Examples:
     114 - Ubuntu Bionic 18.04:
     115{{{#!bash
     116apt update && apt upgrade # always a good idea to keep up to date
     117# install basic development requirements
     118apt install build-essential git
     119# install qt5 runtime and qml modules required
     120apt install qt5-default qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings
     121# install qt5 development packages
     122apt install qtbase5-dev qtdeclarative5-dev qtquickcontrols2-5-dev
     123# install Gstreamer development packages
     124apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev libudev-dev
     125git clone https://github.com/dv1/qtglviddemo
     126cd qtglviddemo
     127qmake
     128make
     129./qtglviddemo
     130}}}
     131
     132See: https://github.com/dv1/qtglviddemo
     133
     134
     135== User Interface Design with QT
     136It is often best to consider QML instead of HTML5 for UI design. QML is much easier to use than HTML5 and is typically just fine for most user interface designs. QML has been designed for compsiting UIs and screen elements from the start while HTML5 had these things added to an existing standard meant for text rendering.