Qt for Android Development Big Pit

Source: Internet
Author: User

Qt for Android Development Big Pit

Author: Qyvlik

Qt 5.5.1

Here's a talk about the more common Qt development in the big pits of Android. Hope that the students do not make unnecessary struggles, skip these pits.

Input box

The first is the input box, and Qt's input is poorly performed on Android.

  1. Unable to support Android native input method to access the QT entry box, that is, the Android Input method cannot copy, paste, cut the QT input box text.

  2. You cannot support using touch to select text in the Qt input box.

  3. If the position of the input box is at the bottom of the app, like IM, the chat tool should be noted.

    A. If the application Activity is set to android:windowSoftInputMode="adjustResize" , when the input method is popped, the application interface will be scaled, and the application interface will blink.

    B. If the app Activity is set to android:windowSoftInputMode="adjustPan" , the head of the application screen will be top-out.

  4. To fix the issue of appeal, refer to the following steps

    A. Set the app Activity settings first android:windowSoftInputMode="adjustPan" so that when the input method pops up, it doesn't blink because the interface is scaled.

    B. Get to Android Input method height.

    C. Modify the input box so that it is clicked to get focus before the Input method ( Qt.inputMethod.show() ), because it is not the input box to get the focus and pop-up, so the interface does not blink, and will not be relative to the screen upward displacement. (Just TextField put one on top MouseArea )

    D. After the Input method pops up, you can get the keyboard height (if you get the keyboard height on Android, you need to write some Java code).

    E. After getting to the keyboard height, directly shift the input box (delay processing), then forceActiveFocus force the focus.

  5. The appeal solution raises a question and listens to me.

    A. Qt.inputMethod.show() the keyboard can be displayed directly on Android and then displayed without directly zooming the interface (causing flicker) or by pushing the interface out of the screen.

    B. Next, the input box is a special control, and the input input box takes the focus of the virtual key, and the IME on the Android directly remembers the location of the control.

    C. The next time the direct call Qt.inputMethod.show() , will find the last time to get the focus of the input box position, according to this location, pop-up virtual key break and the interface to the screen, and then the input box will get the keyboard height, displacement.

  6. In order to solve the appeal again, you have to record the height of the keyboard on Android, and then depending on the height of the keyboard to use the Qt.inputMethod.show() pop-up keyboard, or the first shift input box.

    Todo

Already available solution Gdpurjyfs/wellchat, demo video Android repair keyboard popup interface unfriendly issue fix final demo. Of course, now these programs have all kinds of problems, specifically to do, in fact, I hope the official repair keyboard pop-up, the interface zoom flashing when the problem.

Camera

QT Android application of the camera, if the direct use QtMultimedia::Camera may be unable to focus on the situation, and the various models and different versions of the system performance inconsistent, Huawei Mobile phone support for Qt is poor, the problem will be slightly more.

Workaround:

Can be directly through the call system camera software, specific reference qtandroid detailed (3): StartActivity actual combat Android camera function, the specific code a-week-to-develop-android-app-plan/demos/ Callnativecamera.

SplashScreen

splash screen, according to most Qter, when the Qt Android app starts, it displays a black screen with no content, with the title and app Icon, and does not directly pre-display the SplashScreen.

Local multimedia thumbnail image

network resources can be optimized and cached through existing C + + interfaces. However, local multimedia thumbnail support, you need to build a useful.

Web Support

QT Web support for mobile platforms should be to try to support by QtSurface drawing native pages on, so QT Web support is very weak for mobile platforms. Then Qtwebengine is based on Google's Chromium, Chromium now has the best support for VS compilers, while support for MinGW is naturally aborted with VS open source.

Now QT on the mobile device, using Qtwebview is the qtsurface to draw the native Web page as QT on the mobile page of the solution.

Localization map

QtQuick in support of the map plug-in, but the official only prefabricated here and several foreign map plug-ins, Baidu Map can only be packaged plug-ins.

Discusses the use of QML qtlocation Plugin.

Qt for Android Development Big Pit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.