/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use the contact form at ** http://www.qt.io ** ** This file is part of Qt Enterprise Embedded. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. ** ** If you have questions regarding the use of this file, please use ** the contact form at http://www.qt.io ** ****************************************************************************/ /*! \page qtee-customization.html \title Customization \previouspage qtee-building-and-running.html \nextpage qtee-custom-embedded-linux-image.html \section1 Environment and Input By default, the basic environment variables and startup options of \B2Q applications are set in \c{/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 \B2Q 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: \badcode adb remount \endcode In the \c{appcontroller.conf} file, the input devices are specified by the lines similar to these: \badcode env=QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0 \endcode 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 \c QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS. This is necessary because the automatic device discovery would fail to find the touchscreen. \section1 Switching to tslib for Resistive Touchscreens For touchscreens that do not provide modern multitouch capabilities it may be necessary to use the \c 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 \c tslib, add the following line to \c /etc/appcontroller.conf on the device: \badcode env=QT_QPA_EGLFS_TSLIB=1 \endcode \note The \c tslib plugin provides no multitouch events (QTouchEvent). It only generates mouse events (QMouseEvent). If necessary, the device can be specified explicitly by setting \c TSLIB_TSDEVICE: \badcode env=TSLIB_TSDEVICE=/dev/input/event1 \endcode \section1 Booting to a Custom Application By default, the \e {\B2Q demo launcher} is configured to run on startup. To have your application launch on boot: \list \li Go to \b Projects > \b {Run Settings}. \li Under \b Deployment, click on \b {Add Deploy Step}, and select \b {Make this application the default one}. \li Re-deploy your project. In \b Edit mode, right-click on the project and select \b Deploy, or click \inlineimage qtcreator-run.png (\b{Run}). \endlist Your application will now be launched on the next device reboot. Alternatively, you can also use the following command: \badcode adb shell appcontroller --make-default \endcode Where \c{} is the install path of your application binary on the device. To remove your application from the default startup, use the following command: \badcode adb shell appcontroller --remove-default \endcode \section1 Configuring Display Resolution Steps for configuring a custom resolution depend on the device and display. \b {i.MX6 Devices} The resolution can be changed by modifying the file \c 6x_bootscript on the boot partition of the SD card. First, strip off the header from the file: \badcode dd if=6x_bootscript of=my_bootscript ibs=72 skip=1 \endcode Open the file in a text editor, and edit the following line(s), depending on your display: \table \header \li Display \li Line to Edit \row \li HDMI \li line 79:\br \c {video=mxcfb${nextcon}:dev=hdmi,1280x720M@60,if=RGB24} \row \li Freescale \li line 88:\br \c {video=mxcfb${nextcon}:dev=ldb,LDB-XGA,if=RGB666} \row \li ft5x06 \li lines 101 to 104:\br \c {video=mxcfb${nextcon}:dev=ldb,1280x800MR@60,if=RGB666}\br \c {video=mxcfb${nextcon}:dev=ldb,1024x600M@60,if=RGB666} \row \li ILI210x \li line 122:\br \c {video=mxcfb${nextcon}:dev=ldb,1024x600M@60,if=RGB666} \row \li Other Displays \li lines 135 to 137:\br \c {display="320x240MR@60,if=RGB24";}\br \c {display="CLAA-WVGA,if=RGB666";} \endtable Save the file and call \c mkimage with following parameters: \badcode mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "boot script" -d my_bootscript 6x_bootscript \endcode Finally, copy the file back onto the SD card. \b {BeagleBone Black} Edit the file \c uEnv.txt and add the following line to set a custom resolution: \badcode video=HDMI-A-1:640x480@60 \endcode Unfortunately, \c 1280x720@60 is currently the only resolution supported for BeagleBone Black. \b {Raspberry Pi} By default, the resolution is chosen automatically depending on the connected monitor. To select specific display settings, edit the file \c config.txt on the boot partition of the SD card. Scroll down to the \c {"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 \l{http://www.raspberrypi.org/documentation/configuration/config-txt.md}{config.txt}. \section1 Configuring the physical screen size for scalable user interfaces The \e {\B2Q 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 \e {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. \section1 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. \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(); } } } } \endqml \section1 Using Network Connection for ADB By default, \B2Q uses USB cable for communication between device and Qt Creator. On \B2QL, you can change the device to use ethernet network connection (IPv4) for the communication. To enable network connection, you need to modify file \c /etc/default/adbd located on the devices, and change value of \c USE_ETHERNET to \c 'yes'. This can also be done with \c adb, while the device is still connected via USB. \badcode adb shell "sed -i -e 's/USE_ETHERNET=no/USE_ETHERNET=yes/' /etc/default/adbd; sync" \endcode \note You need to restart the device for this change to take effect. \include b2qt-post-install-setup.qdocinc configuring network device */