Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Sloved]question about QGesture's malloc.
Qt 6.11 is out! See what's new in the release blog

[Sloved]question about QGesture's malloc.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.1k 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.
  • T Offline
    T Offline
    twicave
    wrote on last edited by
    #1

    In Qt4.8.4, QGesture has several derived class, each of them represent a single gesture.
    So, for a QWidget, if it support 3 kinds of gesture, There should be 3 deferent instances of QGesture is created(with different sub class)?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Adrien Leravat
      wrote on last edited by
      #2

      Hi twicave,

      QGesture events are created by Qt underlying gesture system itself, and can be handled in the QWidget::event method. So you don't have to create those objects. To handle them you have to subclass QWidget (or a derivated class) and reimplement the event method. You could also use an event filter to catch the event.

      Use grabGesture method to tell Qt you want to handle Gesture events.

      Have a look at gesture handling "Here":http://doc.qt.digia.com/main-snapshot/gestures-overview.html

      Adeneo Embedded - www.adeneo-embedded.com

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tzander
        wrote on last edited by
        #3

        The QGesture is essentially an object that is kept around to store info in.
        The amount of QGesture instances is equal to the amount of gestures you grab, times the amount of widgets you do this on.
        Notice that Qt handles this object, and deletes it properly for you at the end of the application.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          twicave
          wrote on last edited by
          #4

          thanks, you are both right.
          the QGesture object is allocated when grabGesture() is called.

          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