at_ito
2014年4月23日 18時09分
http://stackoverflow.com/questions/20633654/create-a-multi-touch-qt-5-1-application
上記URLを参考に、Qtでマルチタッチができるかどうかを試してみました。
コードは以下の通り。
import QtQuick 2.0
Rectangle {
width: 800; height: 480
MultiPointTouchArea {
anchors.fill: parent
touchPoints: [
TouchPoint { id: point1 },
TouchPoint { id: point2 }
]
}
Rectangle {
width: 30; height: 30
color: "green"
x: point1.x
y: point1.y
}
Rectangle {
width: 30; height: 30
color: "yellow"
x: point2.x
y: point2.y
}
}
上記コードを適当なファイル名(今回はtest.qmlにしました)で保存して、 Armadillo上で以下のように実行。
[armadillo ~]$ export QT_QPA_EGLFS_DISPLAY=1
[armadillo ~]$ export QT_QPA_EGLFS_WIDTH=800
[armadillo ~]$ export QT_QPA_EGLFS_HEIGHT=480
[armadillo ~]$ export QT_QPA_EGLFS_HIDECURSOR=1
[armadillo ~]$ qmlscene test.qml
Armadillo-840 液晶モデル開発セットでは2点の同時タッチに対応しているので、 指2本でタッチすると、緑の四角と、黄色の四角がそれぞれタッチした場所に移動します。
簡単に動きを確認する場合などは、QMLが便利ですね。