Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Why does QtQuick does not have TouchArea (like MouseArea) ?
Forum Updated to NodeBB v4.3 + New Features

Why does QtQuick does not have TouchArea (like MouseArea) ?

Scheduled Pinned Locked Moved QML and Qt Quick
18 Posts 2 Posters 6.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aabc
    wrote on last edited by
    #1

    Why does QtQuick does not have TouchArea (like MouseArea) ?
    Isn't QtQuick designed for tablets and smartphones ?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      It is. They just work. One-finger gestures are recognised as mouse events. If you want 2-finger operation, you can take a look at "PinchArea":http://qt-project.org/doc/qt-4.8/qml-pincharea.html.

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aabc
        wrote on last edited by
        #3

        The problem is that the touch on QML works much worse than the touch in QWidgets with Qt::WA_AcceptTouchEvents.
        Is there a way to make QML touch works like QWidget ?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          In what way worse? It's not easy to help you when you don't specify what is wrong ;)

          I have tested on Android, and touch in QML works (for me) perfectly. 2-finger gestures, tapping, flicking, long-tap: no complaints from me :)

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aabc
            wrote on last edited by
            #5

            On embedded linux device with touch - when I try QML application - the touch works much worse than QWidget with touch works on the same device.
            Did you try QML application on embeddedc linux device ?

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              No, only desktop and Android. Which in a way is an embedded linux device, but I'm sure that is not what you mean :)

              (Z(:^

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aabc
                wrote on last edited by
                #7

                Can you show me a code sample of touch (mouse) interaction you have in QML ?

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  Here is a whole, big project I'm working on: "LINK":https://gitorious.org/closecombatfree/closecombatfree/blobs/master/qml/scenarios/Scenario.qml.

                  And some relevant pieces of code:
                  @
                  Flickable {
                  id: gameArea
                  height: someHeight
                  contentWidth: map.width
                  contentHeight: map.height
                  boundsBehavior: Flickable.StopAtBounds
                  clip: true

                      anchors.top: root.top
                      anchors.left: root.left
                      anchors.right: root.right
                  
                      PinchArea {
                          id: pinchArea
                          anchors.fill: parent
                  
                          onPinchUpdated: {
                              zoom += pinch.scale - pinch.previousScale;
                          }
                      }
                  

                  }
                  @

                  Flickable element makes it possible to swype (move the map around), PinchArea is used for zooming. Tapping and long tapping is handled by MouseArea, just like on desktop. In case of my app, the code is quite complicated at that stage, but in principle, it's just as easy on desktop, as on mobile devices.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    aabc
                    wrote on last edited by
                    #9

                    Thanks.
                    Did you try List dragging and buttons ?

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      Yes. I use GridView for that, it inherits Flickable, so that solves dragging problem. As items for it, I use just rectangles with MouseAreas inside them (one MouseArea per every button).

                      There were some bugs there, now I think about it, but I think it had more to do with my (at that time) sloppy coding.

                      (Z(:^

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        aabc
                        wrote on last edited by
                        #11

                        On what HW did you test it (CPU's, RAM, clock speed, openGL) ?

                        1 Reply Last reply
                        0
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          Samsung Galaxy S2 (dualcore ARM 1.2GHz, 1GB RAM), both on Android 2.3 and 4.0.4 (CyanogenMod). I don't remember if OpenGL support was available at that time (half a year ago).

                          Currently I have ported my project to Qt5, which is not yet available on droid, so I don't have up-to-date news.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            aabc
                            wrote on last edited by
                            #13

                            Does QT 5 improved your QML apps performance ?

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #14

                              Performance was good anyway, so I've seen no dramatic improvement because there was nothing to improve on ;) I did not run any benchmarks, though.

                              Nokia did some tests 1,5 years ago and it was, IIRC, about 200% faster. A lot has been done since then, so it might be even faster now (or not).

                              I did the move because I wanted to test some new features early (new particle system, 'var' properties, V8 engine, etc.). The project I am working on is an after-work hobby anyway, so I can do that easily :)

                              (Z(:^

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                aabc
                                wrote on last edited by
                                #15

                                Was the touch performance were better with pen (stylus) than with finger touch ?

                                1 Reply Last reply
                                0
                                • sierdzioS Offline
                                  sierdzioS Offline
                                  sierdzio
                                  Moderators
                                  wrote on last edited by
                                  #16

                                  I've used my fingers only, no stylus.

                                  (Z(:^

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    aabc
                                    wrote on last edited by
                                    #17

                                    Thanks !

                                    1 Reply Last reply
                                    0
                                    • sierdzioS Offline
                                      sierdzioS Offline
                                      sierdzio
                                      Moderators
                                      wrote on last edited by
                                      #18

                                      Cheers. Hope it helped.

                                      (Z(:^

                                      1 Reply Last reply
                                      0

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved