summaryrefslogtreecommitdiffstats
path: root/src/doc/src/qtee-customization.qdoc
blob: 68f1b7d009bb0b43e9cd1c5bf6d1df085b6b6eea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/****************************************************************************
**
** 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 <path>
    \endcode

    Where \c{<path>} 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
*/