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. signal set from button on click, but not touch
Forum Updated to NodeBB v4.3 + New Features

signal set from button on click, but not touch

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 689 Views
  • 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.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on 3 Jan 2019, 22:21 last edited by igor_stravinsky 1 Mar 2019, 23:08
    #1

    Qt Quick Controls 2 5.11

    I've got a button that should send a signal to a parent view when clicked. Everything works as it should when clicked with a mouse, but when I tap the button on a touch screen (a Windows 10 surface) I can see that the onClicked() code is executed, but the slot for the signal never responds.

    Any idea why clicks would behave one way, but taps wouldn't?

    Drawer{
      id: myDrawer
    }
    
    Rectangle {
        id: root
        signal: mySignal()
    
        onMySignal:{
               myDrawer.open()
            }
    
         Item{
           Item{
             Button{
                  id:myButton
                  property int tapCount: 0;
                 onClicked: {
                        root.mySignal()
                        tapCount++;
                        myButton.text = tapCount;
                    }
           }
          }
        }
    }
    
    1 Reply Last reply
    0
    • I Offline
      I Offline
      igor_stravinsky
      wrote on 3 Jan 2019, 23:07 last edited by igor_stravinsky 1 Aug 2019, 00:54
      #2

      Further testing shows that the signal is getting received by the onMySignal() handler, but that the call inside that handler to open a drawer isn't being called.

      I also can't change the opacity of an object outside the root rectangle hierarchy, so it's as if there's a scoping issue, and that from inside onMySignal(), I can't reference objects outside, but only when the button is touched.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dheerendra
        Qt Champions 2022
        wrote on 4 Jan 2019, 04:42 last edited by
        #3

        Try providing the height and width for Drawer.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        I 1 Reply Last reply 4 Jan 2019, 17:49
        0
        • D dheerendra
          4 Jan 2019, 04:42

          Try providing the height and width for Drawer.

          I Offline
          I Offline
          igor_stravinsky
          wrote on 4 Jan 2019, 17:49 last edited by
          #4

          @dheerendra
          I was trying to simplify the code. In reality myDrawer is a separate class that derives from a Drawer, and starts off like this:

          Drawer {
              id:root
              height:parent.height
              width:450
              dragMargin:0
              edge:Qt.RightEdge
              }
          

          And, as I mentioned, the drawer opens when the button is clicked on with a mouse, but not when tapped with a finger.

          1 Reply Last reply
          0

          1/4

          3 Jan 2019, 22: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