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. Using of property mouse.accepted
Forum Updated to NodeBB v4.3 + New Features

Using of property mouse.accepted

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 2.7k 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.
  • V Offline
    V Offline
    vlada
    wrote on 2 Dec 2021, 12:21 last edited by
    #1

    Hello,

    I'm working on upgrade of my application to Qt6. I have a code, which looks like this:

                MouseArea {
                    id: myMouseArea
                    anchors.fill: parent
                    enabled: true
                    propagateComposedEvents: true
    
                    onPressed: {
                        mouse.accepted = false;
                        doSomething();
                    }
                }
    

    Below this MouseArea is another one. What I need to achieve is that clicking this MouseArea will be propagated also to the item below. This code works fine, but in Qt6 I get this warning:

    qt.qml.context: qrc:/qml/MainTouch.qml:393:13 Parameter "mouse" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
    

    How do I fix this problem?

    Generally, I have a lot of issues with removed or renamed properties between Qt5 and Qt6. But I'm having a really hard time to find out what and why has been something changed. Is there any documentation, that could help me with that? Thank you.

    K 1 Reply Last reply 2 Dec 2021, 12:24
    1
    • V vlada
      2 Dec 2021, 12:21

      Hello,

      I'm working on upgrade of my application to Qt6. I have a code, which looks like this:

                  MouseArea {
                      id: myMouseArea
                      anchors.fill: parent
                      enabled: true
                      propagateComposedEvents: true
      
                      onPressed: {
                          mouse.accepted = false;
                          doSomething();
                      }
                  }
      

      Below this MouseArea is another one. What I need to achieve is that clicking this MouseArea will be propagated also to the item below. This code works fine, but in Qt6 I get this warning:

      qt.qml.context: qrc:/qml/MainTouch.qml:393:13 Parameter "mouse" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
      

      How do I fix this problem?

      Generally, I have a lot of issues with removed or renamed properties between Qt5 and Qt6. But I'm having a really hard time to find out what and why has been something changed. Is there any documentation, that could help me with that? Thank you.

      K Offline
      K Offline
      KroMignon
      wrote on 2 Dec 2021, 12:24 last edited by KroMignon 12 Feb 2021, 12:28
      #2

      @vlada said in Using of property mouse.accepted:

      How do I fix this problem?

      I would say replace mouse by myMouseArea
      According to documentation, you have to change like this:

      onPressed: (mouse)=> {
                      mouse.accepted = false
                      doSomething();
                  }
      

      cf: https://doc.qt.io/qt-6/qml-qtquick-mousearea.html or https://doc.qt.io/qt-6/qtquick-mousearea-example.html

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      1
      • V Offline
        V Offline
        vlada
        wrote on 2 Dec 2021, 12:38 last edited by
        #3

        Thank you! This works fine.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GrecKo
          Qt Champions 2018
          wrote on 2 Dec 2021, 15:21 last edited by
          #4

          not that for a single parameter you can get rid of the parenthesis, mouse => { ... } works

          1 Reply Last reply
          0

          1/4

          2 Dec 2021, 12:21

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved