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. [Solved]How to receive QGestureEvent in parent widget?
Forum Updated to NodeBB v4.3 + New Features

[Solved]How to receive QGestureEvent in parent widget?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 3.2k 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

    QT version: 4.8.4

    My Application Brief Introduction:
    In the most parent widget I set grabGesture(), and I want process several types of QGesture in its virtual function QWidget::event(). sometimes I can receive that message. But sometimes, when I touch in a QGraphicsScene, I found such error prompt:
    "QGestureManager::deliverEvent: could not find the target for gesture".

    Here is my question: If I touched in a QGraphicsItem In a QGraphicsScene, or I just touched in QGrahicsScene, wether or not the event will be auto transfer to parent QWidget? I do need such auto transfer progress. How can I do?

    How to eliminate that error message?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      The event gets delivered to the QGraphicsView (or it's viewport) which then forwards it to the items in your scene. If the event isn't handled (accepted) event propagation takes place. Meaning the event will be propagated to the graphics views parent, and so on...

      AFAIK QGraphicsItems can't receive touch-/gesture events (unless they are QGraphicsObjects).
      I think you will have to do the logic (determining the affected QGraphicsItems, perform the desired actions, etc.) by yourself.

      I think you receive the warning because there is just no receiver for the gesture event...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

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

        Can widget or a graphicsView filter some gesture away?(stop event progagating)
        If it occurs, which condition can cause that?
        I just cannot locate that filter widget(or graphicsItem).

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          not by default...only if you have implement it.
          Did you call grabGesture() on the qgraphicsview?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

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

            No, I only capture gesture at parent most widget. so that's the problem?

            Btw, I read QGestureEvent's document, and found such information:
            when event type is "QEvent::GestureOverride" , the gesture event is ignored by default. and when type is "QEvent::Gesture", the gesture event is acceptd by default. so is that means if I manually set QGestureEvent's type to "GestureOverride", the Gesture will automatic propagating to parent widget?

            because of using muti-touch, the gesture is designed by myself. but I still can't find a interface to set QEvent:type() to "QEvent::GestureOverride".

            grabGesture() in every widgets seem's too complex and inconvenient.

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

              I finally found the reason. the error msg is coming from the coordinate value, in derived QGestureRecognizer, I miss using the widget base coordinate value, not the global coordinate values. And the main widget is fixed at screen center. so when I operate in the upper or left zone of widget. the gestureRecognizer thinks it's beyond the main window, so display that error msg.

              coordinate is very important.

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                well...you never mentioned that you derived QGestureRecognizer until the last post.
                How should anybody be able to help you looking for the reason of the problem, when you leave out such important information?

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                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