Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Wiki Discussion
  4. Example on faking tap gesture on a desktop app
Forum Update on Monday, May 27th 2025

Example on faking tap gesture on a desktop app

Scheduled Pinned Locked Moved Wiki Discussion
4 Posts 1 Posters 4.1k Views
  • 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on 20 Aug 2010, 10:29 last edited by
    #1

    Just yesterday a team mate asked me how to fake a gesture event on a desktop, say by clicking on a button, and I quickly wrote "this":http://developer.qt.nokia.com/wiki/TapGestureExampleOnDesktop example using Qt Designer form, a push button when clicked sends a tap gesture

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on 21 Sept 2010, 16:04 last edited by
      #2

      @void MainWindow::gest()
      {
      QTapGesture tapGes;
      tapGes.setPosition(QPointF(5,5));
      QList<QGesture *> tapGesTureList;
      tapGesTureList.append(&tapGes);
      QGestureEvent event(tapGesTureList);
      QCoreApplication::sendEvent(this, &event);
      }@

      Are you sure that pointer on the tapGes will be alive? May be next better:

      @void MainWindow::gest()
      {
      QTapGesture *tapGes = new QTapGesture(this);
      tapGes->setPosition(QPointF(5,5));
      QList<QGesture *> tapGesTureList;
      tapGesTureList.append(tapGes);
      QGestureEvent event(tapGesTureList);
      QCoreApplication::sendEvent(this, &event);
      }@

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on 21 Sept 2010, 20:02 last edited by
        #3

        that example was just to show how to mimic a gesture, and also agree with you that, if required, using a pointer there will keep it alive :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexander
          wrote on 22 Sept 2010, 10:27 last edited by
          #4

          chetankjain, yes:) but, unfortunately, I understood, ~QGestureEvent does not delete pointers on QTapGesture and they all will be accumulated in the application memory and will be deleted only when MainWindow is destroyed.

          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