我无法找到虚拟键盘的尺寸.这是一个例子:
Rectangle {
Component.onCompleted: {
Qt.inputMethod.visibleChanged.connect(resizeForKeyboard)
}
Component.onDestruction: {
Qt.inputMethod.visibleChanged.disconnect(resizeForKeyboard)
}
function resizeForKeyboard(){
console.log('Visibility changed!!!');
var keys = Object.keys(Qt.inputMethod.keyboardRectangle);
var rect = Qt.inputMethod.keyboardRectangle;
//A simple script I have for debugging, this loops
//through the keys and prints all properties
DataMethods.printObject(keys, '[INPUT]');
DataMethods.printObject(rect , '[RECTANGLE]');
}
//using the controls to save time
TextField {
focus: true //force keyboard to show up.
}
}
Run Code Online (Sandbox Code Playgroud)
datamethods.js(相关方法)
/**
* This method prints an object to the console for debug purposes
* obj -> the …Run Code Online (Sandbox Code Playgroud)