Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 5.2 RC1 MouseArea not working with PinchArea
Qt 6.11 is out! See what's new in the release blog

Qt 5.2 RC1 MouseArea not working with PinchArea

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 2 Posters 4.8k 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.
  • E Offline
    E Offline
    Esperantisto
    wrote on last edited by
    #1

    If I add a PinchArea after a MouseArea then the MouseArea stops responding. This used to work fine in 5.1.1. Before I create a bug report, is this designed behavior? Am I missing something?

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

      Please define "after" more clearly. Are they placed in your file like this:
      @
      MouseArea {}
      PinchArea {}
      @

      and anchored to fill the parent, or like that:
      @
      MouseArea {
      PinchArea {}
      }
      @

      In any case, if it used to work and now it does not, it's likely to be a regression. Please "file a bug report":https://qt-project.org/wiki/ReportingBugsInQt if there is none reported for this already. I don't feel it's likely to be considered important enough for fixing before Qt 5.2 comes out, but maybe it will make it into 5.2.1.

      (Z(:^

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Esperantisto
        wrote on last edited by
        #3

        I tried a number of things: one embedded in the other, one befor the other, etc. In every case, whichever one is deamed on top gets the input and the other doesn't work at all.

        Perhaps there's a better way to handle input in a cross-platform way? If not then this seems like a pretty severe limitation.

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

          OK, let's try this: in whichever component is the topmost one, add this line to your event handler:
          @
          // for example, in onClicked:
          accepted = false;
          @

          (Z(:^

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Esperantisto
            wrote on last edited by
            #5

            I get 'Error: Invalid write to global property "accepted"'.

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

              You've probably put it in a wrong place. You need to put it in a slot you are using in your MouseArea, which has an input MouseEvent. For example:
              @
              MouseArea {
              /// some code
              onClicked: {
              // some logic
              accepted = false;
              }
              }
              @

              (Z(:^

              1 Reply Last reply
              0
              • E Offline
                E Offline
                Esperantisto
                wrote on last edited by
                #7

                Here's where I tried it:

                @MouseArea {
                // . . .
                onPressed: {
                // . . .
                accepted = false;
                }
                onPositionChanged: {
                // . . .
                accepted = false;
                }
                }@

                Also here:

                @PinchArea {
                // . . .
                onPinchStarted: {
                // . . .
                accepted = false;
                }
                onPinchUpdated: {
                // . . .
                accepted = false;
                }
                }@

                In both cases I get that error message.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  Esperantisto
                  wrote on last edited by
                  #8

                  OK, if I do this then the MouseArea works and the PinchArea does not:

                  @PinchArea {
                  anchors.fill: parent

                  onPinchStarted: {
                  // . . .
                  }
                  onPinchUpdated: {
                  // . . .
                  }
                  }

                  MouseArea {
                  anchors.fill: parent

                  onPressed: {
                  // . . .
                  }
                  onPositionChanged: {
                  // . . .
                  }
                  }@

                  If I do this then the PinchArea works and the MouseArea does not:

                  @PinchArea {
                  anchors.fill: parent

                  onPinchStarted: {
                  // . . .
                  }
                  onPinchUpdated: {
                  // . . .
                  }
                  }

                  MouseArea {
                  anchors.fill: parent

                  onPressed: {
                  // . . .
                  mouse.accepted = false;
                  }
                  onPositionChanged: {
                  // . . .
                  mouse.accepted = false;
                  }
                  }@

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

                    Then maybe it is indeed a bug :)

                    (Z(:^

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      Esperantisto
                      wrote on last edited by
                      #10

                      Is there a better way to do panning/zooming?

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        Esperantisto
                        wrote on last edited by
                        #11

                        It works if MouseArea is embedded in the PinchArea except for onWheel on desktop.

                        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