IOS: sometimes the keyboard pushes the whole qml page

I am developing a cross-platform QML QtQuick application. One of the windows is a typical chat with a title, message area and TextEdit entry below. On iOS (both in the simulator and on the real device), I ran into a problem with the virtual keyboard, which “moves” the text editing, as well as the whole window up and does not allow to see the title.

Here is a screenshot of the application window: https://drive.google.com/file/d/0B6ZI4g3F2MLOSXB2RjBDbGNEWEk

The same question is already registered in the Qt tracker. But there is no solution. Moreover, a similar problem was reported on the forum without an answer.

Any ideas on a solution or a workaround?

+4
source share
2 answers

In the past, I have implemented work, but it is really problematic.

Avoiding the keyboard is a pain, and the Qt one-time use approach for scrolling the entire screen is not ideal (especially when it is glitchy and the pain turns off), which leads to the navigation panels moving from the screen, etc.

Basically, my work was as follows:

  • add MouseAreaas a child TextField, this will stop the focus setting and default scroll behavior for clicking
  • in the handler onClickfor this MouseArea, move the field so that it is not under the area where the keyboard will be displayed. This can be done using states, such as behavior animations.
  • , , ( , )

. , - , ObjC, ( QML ).

, .. , . , , , "" ( iPads) .. Qt.inputmethod

Qt, , . UIKit ( , , , , ).

+2

QTextEdit iOS. , QTextEdit . qt , qt , , inputMethodQuery Qt:: ImCursorRectangle, . , , QRectF Qt:: ImCursorRectangle

QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
{
    if (property & Qt::ImCursorRectangle) {
        return QVariant(QRectF(0,0, 0, 0));
    } else {
        return QTextEdit::inputMethodQuery(property);
    }
}
0

Source: https://habr.com/ru/post/1623713/


All Articles