小键盘对于qml应用是经常用到的,在qml里面,就如一个fileDialog也要自己画一样,小键盘keyboard也是要自己画的,对于相应的每个按键的clicked都要一一实现的。
这里有一个示例:
代码如下:
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Window 2.0
import QtQuick.Layouts 1.1
ApplicationWindow {
visible: true
width: 700
height: 480
title: qsTr("Hello World")
Grid{
anchors.right:parent.right
anchors.rightMargin: 60
anchors.top:parent.top
anchors.topMargin: 20
flow:Grid.LeftToRight
spacing: 0
width: 360
height: 400
clip: true
Repeater{
id:numGridRep
model:["1","2","3","","4","5","6","","7","8","9","",&