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. How to forward Wheel events to parent of TableView?
Forum Updated to NodeBB v4.3 + New Features

How to forward Wheel events to parent of TableView?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 4 Posters 3.2k Views 2 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.
  • K Offline
    K Offline
    Kofr
    wrote on last edited by
    #1

    I have this

    ListView {
    ...
        TableView {
        ...
        }
    }
    

    If i use mouse's wheel over TableView the parent component ListView do not scroll of the mouse wheel event.
    What solution could be for this?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @Kofr How did you capture mouse events for TableView?

      157

      K 1 Reply Last reply
      1
      • p3c0P p3c0

        @Kofr How did you capture mouse events for TableView?

        K Offline
        K Offline
        Kofr
        wrote on last edited by
        #3

        @p3c0 with defauld TableView's interaction. I do not use any custom delegates or something.
        So when I roll the wheel the whel actions are consumd by `TableView even if it is not scrollable.

        A p3c0P 2 Replies Last reply
        0
        • K Kofr

          @p3c0 with defauld TableView's interaction. I do not use any custom delegates or something.
          So when I roll the wheel the whel actions are consumd by `TableView even if it is not scrollable.

          A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          @Kofr Can you show us the wheelEvent function in your tableview? It sounds like you are taking the events even when you don't want them.

          If you don't accept the event during times where you don't want to handle them it will move on to the next event handler. I.e. event->setAccepted(false).

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          0
          • K Kofr

            @p3c0 with defauld TableView's interaction. I do not use any custom delegates or something.
            So when I roll the wheel the whel actions are consumd by `TableView even if it is not scrollable.

            p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            @Kofr I'm too not sure how to foward these events without MouseArea. I suppose these mouse areas are in the default implementation which we cannot modify.
            Btw. why do you have such requirement where these 2 views overlap ?

            157

            K 1 Reply Last reply
            1
            • p3c0P p3c0

              @Kofr I'm too not sure how to foward these events without MouseArea. I suppose these mouse areas are in the default implementation which we cannot modify.
              Btw. why do you have such requirement where these 2 views overlap ?

              K Offline
              K Offline
              Kofr
              wrote on last edited by
              #6

              @p3c0 I have TableView as a delegate of ListView

              p3c0P 1 Reply Last reply
              0
              • K Kofr

                @p3c0 I have TableView as a delegate of ListView

                p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #7

                @Kofr Try pressDelay. For eg.

                pressDelay: 1000
                

                157

                K 1 Reply Last reply
                2
                • p3c0P p3c0

                  @Kofr Try pressDelay. For eg.

                  pressDelay: 1000
                  
                  K Offline
                  K Offline
                  Kofr
                  wrote on last edited by
                  #8

                  @p3c0 it works perfectly. thank you!

                  A 1 Reply Last reply
                  0
                  • K Kofr

                    @p3c0 it works perfectly. thank you!

                    A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #9

                    @Kofr @p3c0 is the master of QML! :) No idea why pressDelay would work, would never have thought of trying that, lol.

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #10

                      @ambershark Thanks. I'm still learning :)
                      pressDelay as the name says allows the Item to wait for a certain period of time before it propagates events to the children i.e the delegates. If not specified the events are instantly sent to the children and then never propagated back unless we add any such functionality which we can't in the default implementation.

                      157

                      1 Reply Last reply
                      1
                      • GrecKoG Offline
                        GrecKoG Offline
                        GrecKo
                        Qt Champions 2018
                        wrote on last edited by
                        #11

                        I would have used interactive: false that seems much more suited for your problem and obvious unless I don't understand your problem.

                        K 1 Reply Last reply
                        0
                        • GrecKoG GrecKo

                          I would have used interactive: false that seems much more suited for your problem and obvious unless I don't understand your problem.

                          K Offline
                          K Offline
                          Kofr
                          wrote on last edited by
                          #12

                          @GrecKo interactive property blocks all events, in my case pressDelay: 500 make it work with clicks but not with wheel events. Tricky thing however.

                          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