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.
On some devices, the root file system (where this file resides) is mounted read-only at boot time. To allow modification, remount it read-write by entering the following command:
adb remount
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 Settings.
- Under Deployment, click on Add Deploy Step, and select Make this application the default one.
- 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 use the following command:
adb shell 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, use the following command:
adb shell appcontroller --remove-default
Configuring Display Resolution
Steps for configuring a custom resolution depend on the device and display.
i.MX6 Devices
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_hdmi | HDMI display |
fb_lcd | LCD display |
fb_lvds | LVDS display |
fb_lvds2 | LVDS2 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
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(); } } } }
Using Network Connection for ADB
By default, Boot to Qt uses USB cable for communication between device and Qt Creator. On Boot to Qt for embedded Linux, you can change the device to use ethernet network connection (IPv4) for the communication. To enable network connection, you need to modify file /etc/default/adbd
located on the devices, and change value of USE_ETHERNET
to 'yes'
. This can also be done with adb
, while the device is still connected via USB.
adb shell "sed -i -e 's/USE_ETHERNET=no/USE_ETHERNET=yes/' /etc/default/adbd; sync"
Note: You need to restart the device for this change to take effect.
After you have prepared the hardware, you must set up the development tools in Qt Creator for your device. Connect your device to the network via an Ethernet cable and launch Qt Creator. In Qt Creator:
- Select Tools > Options > Devices > Add.
- Select Boot2Qt Device > Start Wizard.
- Enter the device name and network address (IPv4). You can check the device address in the Launcher Settings when the device is running the Boot to Qt demo.
- Select Finish.
You also have to configure the correct device to be used for each build and run kit:
- Select Tools > Options > Build & Run > Kits.
- Select one of the predefined kits starting with Boot to Qt... that matches the type of your device.
- Select the correct device in the Device field.
- Select OK.
Available under certain Qt licenses.
Find out more.