peter70
peter70

Reputation: 1113

Qt C++ Hidding Keyboard on iOS 11.4.1

In a C++ widget-app I have a QLineEdit. When the edit field got focus, the system opens and shows keyboard automatically. Because I have an RFID Scanner-Stick I don't need the system keyboard, rather it should stay closed/hidden! How can I reach this, or how can I catch the keyboard open event and close/hide it?

I would show you some code to simplify my description, but particular for this problem I don't have any code...

Upvotes: 2

Views: 675

Answers (2)

xiaokai xiao
xiaokai xiao

Reputation: 1

your code hide keyboard success,but qlineedit losted focus state and have no mouse pointer,how to do this?thinks.

Upvotes: 0

K9spud
K9spud

Reputation: 333

To disable the automatic appearance of the software input keyboard entirely, you can use:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setAutoSipEnabled(false);
    (...)
}

If you want to force the display or hiding of the keyboard dynamically in your code, you can use:

QInputMethod* input = QGuiApplication::inputMethod();
input->setVisible([false | true]);

Note: I do not own any iOS devices to verify this will work for you. The above is from my experience with Qt and the software virtual keyboard on Android.

Upvotes: 3

Related Questions