简体   繁体   中英

show keyboard on focus qml

I'm trying to show the keyboard when the view loads and the TextInput has focus.

TextInput {
  id: textInput
  focus: true
}

I thought the keyboard would show up automatically since the text input has focus. But it doesn't.

So I tried sending this event to the view, but it doesn't show the keyboard on the first load. Please note that I'm loading this qml dynamically using a QML Loader on the first load. The subsequent loads of this view, shows the keyboard as expected.

QEvent event(QEvent::RequestSoftwareInputPanel);
bool sent = QApplication::sendEvent(iView, &event);

See this discussion. virtual keyboard does not appear in QML-based application on Nokia 5230

Try to bring the software input panel with the use of Component.onLoaded:{ }.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM