Qml gesture-related Experiment Module: Introduction to QT. Labs. Gestures Module

Source: Internet
Author: User
1. qtquick 1 vs qtquick2

The two are quite different. You must pay attention to both the module restructuring and the underlying implementation. The following are the differences and lists in the two official documents:

  1. Differences
  2. Difference list
2. QT. Labs. gestures
  • Although there is no formal release module (Types in the Qt.labs module are not guaranteed to remain compatible in future versions.), But in qt4.8, a test module with the gesture feature is provided.

  • In addition, there is an unofficial document written by the developer to learn about the background and main interfaces, attributes, and functions of the gesture module development: getting in touch with QT quick: gestures and qml.

  • However, we still need to pay attention to the following instructions in the QT document:
    Warning: GestureArea is an experimental element whose development has been discontinued. PinchArea is available in QtQuick 1.1 and handles two finger gesture input.
    Note: This element is only functional on devices with touch input.

  • In addition, we have attached a git website, which contains all experimental projects with QT libs features. You can find the modules you need. However, some projects have not been updated for a long time. For example, gestures discussed here.
    Therefore, in actual projects, you need to weigh the balance or find an alternative solution !!!

  • The path of the experiment implementation file in qt5 is xxx/qt5.3.1/qtbase/qml/QT/labs.
    Currently, there are only two built-in feature modules: settings and folderlistmodel.

  • In addition, QT sensor gestures also contains gesture-Related Sensors.

  • In the development documentation of qt5.3, there are also related demos. The path is:xxx/qt5.3.1/qtquick1/examples/declarative/touchinteraction.
    There are three examples in the directory: one is about gesture, the other is the mouse field (mousearea), and the other is the pincharea field.

3. Official demo
import QtQuick 1.0import Qt.labs.gestures 1.0// Only works on platforms with Touch support.Rectangle {id: rectwidth: 320height: 180Text {    anchors.centerIn: parent    text: "Tap / TapAndHold / Pan / Pinch / Swipe\nOnly works on platforms with Touch support."    horizontalAlignment: Text.Center}GestureArea {    anchors.fill: parent    focus: true    // Only some of the many gesture properties are shown. See Gesture documentation.    onTap:        console.log("tap pos = (",gesture.position.x,",",gesture.position.y,")")    onTapAndHold:        console.log("tap and hold pos = (",gesture.position.x,",",gesture.position.y,")")    onPan:        console.log("pan delta = (",gesture.delta.x,",",gesture.delta.y,") acceleration = ",gesture.acceleration)    onPinch:        console.log("pinch center = (",gesture.centerPoint.x,",",gesture.centerPoint.y,") rotation =",gesture.rotationAngle," scale =",gesture.scaleFactor)    onSwipe:        console.log("swipe angle=",gesture.swipeAngle)    onGesture:        console.log("gesture hot spot = (",gesture.hotSpot.x,",",gesture.hotSpot.y,")")}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.