C

Customization

Environment and Input

By default, the basic environment variables and startup options of Boot to Qt applications are set in /etc/appcontroller.conf on embedded Linux devices.

You can customize this file if you target a hardware device that has other input devices than the ones that the Boot to Qt stack is configured for by default.

In the appcontroller.conf file, the input devices are specified by the lines similar to these:

env=QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0

Usually, you do not need to change this setting. USB input devices, such as keyboards and mice, are automatically recognized. The mouse pointer is shown automatically if a mouse is connected.

However, hotplugging may not work, which means that the input devices, such as a keyboard and mouse, have to be connected at boot time.

On some devices, for example the BD-SL-i.MX6, the touchscreen device is specified explicitly with QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS. This is necessary because the automatic device discovery would fail to find the touchscreen.

Switching to tslib for Resistive Touchscreens

For touchscreens that do not provide modern multitouch capabilities it may be necessary to use the tslib library instead of relying on direct event device access and the Linux kernel's multitouch protocol. This also allows calibration and is more suitable for resistive touchscreens that are often used in an industrial setting.

To enable tslib, add the following line to /etc/appcontroller.conf on the device:

env=QT_QPA_EGLFS_TSLIB=1

Note: The tslib plugin provides no multitouch events (QTouchEvent). It only generates mouse events (QMouseEvent).

If necessary, the device can be specified explicitly by setting TSLIB_TSDEVICE:

env=TSLIB_TSDEVICE=/dev/input/event1

Booting to a Custom Application

By default, the Boot to Qt demo launcher is configured to run on startup.

To have your application launch on boot:

  • Go to Projects > Run for the Boot to Qt version you want to customize.
  • Under Deployment, click on Add Deploy Step, and select Change default application.
  • Re-deploy your project. In Edit mode, right-click on the project and select Deploy, or click (Run).

Your application will now be launched on the next device reboot.

Alternatively, you can also run the following command on the device:

appcontroller --make-default <path>

Where <path> is the install path of your application binary on the device.

To remove your application from the default startup, run the following command on the device:

appcontroller --remove-default

Configuring Display Resolution

Steps for configuring a custom resolution depend on the device and display.

Boundary Devices i.MX6 Boards

The resolution can be changed by modifying the boot environment:

Start the device with a serial terminal connected, and hit any key to enter the u-boot prompt:

Hit any key to stop autoboot

A list of available preconfigured panels is shown with the command

fbpanel

There are four variables that control the selected panel for different connection types:

fb_hdmiHDMI display
fb_lcdLCD display
fb_lvdsLVDS display
fb_lvds2LVDS2 display

A complete example configuration for all types could look as follows:

setenv fb_hdmi 1280x720M@60
setenv fb_lcd CLAA-WVGA
setenv fb_lvds hannstar7
setenv fb_lvds2 hannstar
saveenv

If your HDMI screen has a non-default CEA resolution, you should also set

setenv allow_noncea 1
saveenv

For more information, see the Boundary Devices documentation on https://boundarydevices.com/display-configuration-u-boot/.

BeagleBone Black

Edit the file uEnv.txt and add the following line to set a custom resolution:

video=HDMI-A-1:640x480@60

Unfortunately, 1280x720@60 is currently the only resolution supported for BeagleBone Black.

Raspberry Pi

By default, the resolution is chosen automatically depending on the connected monitor. To select specific display settings, edit the file config.txt on the boot partition of the SD card.

Scroll down to the "hdmi_mode" section and search the table for the mode you want to set. Uncomment the line at the end of the section and set the value to the one you picked from the table. Save the file and reboot the device.

For more information, see the Raspberry Pi documentation on config.txt.

Configuring the physical screen size for scalable user interfaces

The Boot to Qt demo launcher and Qt Quick Controls scale automatically to screens of different sizes, from 7" touchscreens to 60" or larger TVs to ensure readability and touch friendliness. For this, Qt has to know the physical dimensions of the screen. By default it tries to query these values from the framebuffer devices. Many kernel drivers do not provide this information, however.

To override and manually set a desired screen size, go the Launcher Settings view and check the Override physical screen size checkbox. Adjust the slider to the desired size. The aspect ratio is assumed to be 16:9. Then tap the reboot button or restart your application. The controls will adjust their sizes based on the new settings.

Switching Between Portrait and Landscape Views

Depending on device screen dimensions and application requirements, it might be desirable to change the default view orientation. The following example shows how to rotate your application in QML.

import QtQuick 2.2

Item {
    id: root
    width: 800
    height: 1280
    // Container element for rotating
    Rectangle {
        id: main
        // Swap the width and height of the root item
        width: root.height
        height: root.width
        anchors.centerIn: parent
        // Rotate 90 degrees clockwise around transformOrigin
        rotation: 90
        // The rotated content
        Text {
            text: qsTr("Hello World")
            anchors.centerIn: parent
        }
        MouseArea {
            anchors.fill: parent
            onClicked: {
                Qt.quit();
            }
        }
    }
}

Available under certain Qt licenses.
Find out more.