1

マウスがどこに移動したかを表すutilety.moveようないくつかの変数のような関数に送信する方法があるのだろうか(newX, newY)

each time event calls function
var coord =  - initioal mouse coords + current mouse coords
utilety.move(coord )
initioal mouse coords  = current mouse coords

したがって、ドラッグターゲットを使用せずに独自のメソッド(おそらくC++のもの)を使用してQML要素の動きを制御するには

4

2 に答える 2

1

モバイルプラットフォーム向けに開発している場合は、QtQuickGesturesプラグインを検討してください。

import Qt.labs.gestures 2.0
GestureArea {
    Tap: {
        when: gesture.hotspot.x > gesture.hotspot.y
        onStarted: console.log("tap in upper right started")
        onFinished: console.log("tap in upper right completed")
    }
}

詳細については、こちらをご覧ください:http: //labs.qt.nokia.com/2010/10/05/getting-in-touch-with-qt-quick-gestures-and-qml/

于 2012-04-27T13:41:51.860 に答える
1

I don't understand your question clearly, but looks like you want to have mouse cordinate in QML.

if that is case then, you can use MouseArea element, it has mouseX and mouseY property which you can use to locate mouse cursor.

and onPositionChanged handler is called when mouse position is changed.

MouseArea {
     anchors.fill: parent
     onPositionChanged: { 
      //var curMouseX = mouseX 
      //var curMouseY = mouseY 
     }
}
于 2012-04-27T00:42:08.293 に答える