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. MouseArea emitting additional 'pressed' signal
Forum Updated to NodeBB v4.3 + New Features

MouseArea emitting additional 'pressed' signal

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 3 Posters 3.1k Views 3 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.
  • A aabc

    I using QML on Linux device with touch screen.
    Sometimes when I pressing a MouseArea it emits another 'pressed' and 'released' signals (In addition to the original events).
    I added log also to the 'clicked' signal and I saw that when the additional 'pressed' and 'released' signals are emitted the 'clicked' signal is not emitted (even though the press and release where both within the MouseArea).
    Can anyone explain why does the additional signals are emitted ?

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

    Hi @aabc,
    As the docs says, a click is defined as a press followed by a release, so if you define all the 3 handlers they are surely going to trigger i.e a press followed by release followed by click event.

    157

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aabc
      wrote on last edited by
      #3

      Hi p3c0,

      The problem is that the 2nd 'pressed' and 'released' events are triggered without someone is actually pressing the MouseArea.

      p3c0P 1 Reply Last reply
      0
      • A aabc

        Hi p3c0,

        The problem is that the 2nd 'pressed' and 'released' events are triggered without someone is actually pressing the MouseArea.

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

        @aabc Strange. Can you post some code to test ? Which Qt version and OS are you using ?

        157

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aabc
          wrote on last edited by
          #5

          I'm using Qt 5.3.1 on Linux (Freescale i.mx53 with touch device).

          Rectangle
          {
              width: 200
              height: 200
              color: "red"
          
              MouseArea
              {
                  anchors.fill: parent
                  onPressed: console.log("Pressed")
                  onReleased: console.log("Released")
                  onClicked: console.log("Clicked")
              }
          }
          
          p3c0P 1 Reply Last reply
          0
          • A aabc

            I'm using Qt 5.3.1 on Linux (Freescale i.mx53 with touch device).

            Rectangle
            {
                width: 200
                height: 200
                color: "red"
            
                MouseArea
                {
                    anchors.fill: parent
                    onPressed: console.log("Pressed")
                    onReleased: console.log("Released")
                    onClicked: console.log("Clicked")
                }
            }
            
            p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by p3c0
            #6

            @aabc I tested it on android device with Qt 5.4.1 and it works as expected. Order of signal trigger is pressed, released and clicked. No other ghost events.

            157

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aabc
              wrote on last edited by
              #7

              It doesn't happens all the time. The phenomenon reproduce once per ~15 times.
              Another strange issue when it does happen - There are 'pressed' and 'released' events but no 'clicked' event.

              p3c0P 1 Reply Last reply
              0
              • A aabc

                It doesn't happens all the time. The phenomenon reproduce once per ~15 times.
                Another strange issue when it does happen - There are 'pressed' and 'released' events but no 'clicked' event.

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

                @aabc Could be a bug in Qt 5.3.1. Can you try with latest one ? Just to confirm. So that you can submit a bug report.

                157

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  RamK
                  wrote on last edited by
                  #9

                  @aabc , I checked with Qt 5.4.1 MSVC2012 OpenGL 32bit and it works correctly.
                  Tried many times and able to get pressed , released and clicked signals in order.
                  You will not get clicked signal in one case ,
                  if you do press in Rectangle region (200 * 200 ) and do mouse move outside and perform mouse release.
                  then you will get only pressed & released.

                  p3c0P 1 Reply Last reply
                  0
                  • R RamK

                    @aabc , I checked with Qt 5.4.1 MSVC2012 OpenGL 32bit and it works correctly.
                    Tried many times and able to get pressed , released and clicked signals in order.
                    You will not get clicked signal in one case ,
                    if you do press in Rectangle region (200 * 200 ) and do mouse move outside and perform mouse release.
                    then you will get only pressed & released.

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

                    @RamK Because that is what click is defined. From the docs:

                    A click is defined as a press followed by a release, both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and releasing is also considered a click).

                    157

                    A 1 Reply Last reply
                    0
                    • p3c0P p3c0

                      @RamK Because that is what click is defined. From the docs:

                      A click is defined as a press followed by a release, both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and releasing is also considered a click).

                      A Offline
                      A Offline
                      aabc
                      wrote on last edited by
                      #11

                      There sould have been 'clicked' signal:
                      I logged the X and Y coordinates of the 'pressed' and the 'released' and they both were within the MouseArea.

                      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