Unsolved signal set from button on click, but not touch
-
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; } } } } }
-
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.
-
Try providing the height and width for Drawer.
-
@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.