一. 实现
inputcontex.h增加如下内容:
1 Q_PROPERTY(QRectF inputItemGeetry READ inputItemGeetry) 2 QRectF inputItemGeetry();inputcontexpp增加如下内容:
1 QRectF InputContext::inputItemGeetry() 2我们使用这个函数来获取当前控件的位置和大小信息。
InputPanel.qml增加如下内容:
1 anchors.horizontalCenter: parent.horizontalCenter 2 width: Screen.desktopAvailableWidth * 2 / 3 3 4 states: State 11 } 12 transitions: Transition 22 } 23 } 24 function getInputY() 28 else if(InputContext.inputItemGeetry.y keyboard.height 100 >= 0) 29 32 else 33 36 }我们使用getInputY函数根据输入控件的位置和大小来调整Qt键盘的位置。
二. 效果
上一篇:Qt QTabWidget 竖向 QTabBar横向
下一篇:Qt 图例类QLegend详解
Qt









