How to detect two-fingers double tap in QML? - qml

How to detect two-fingers double tap in QML? Does it reachable somehow with QML classes out-of-the-box? Or, do I need to play with timer and MultiPointHandler QML Type?

Related

Godot - Check if Controller connected or not

I have a small tutorial in my game, which should tell the player how controlls work. There are not many, but it doesn't hurt to show them anyway.
So my game supports controller and keyboard + mouse. If the player has a controller plugged in, I want to show him the controller controls and if not, I want to show him the keyboard + mouse controls.
Now I have something like this already implemented which checks the MOUSE MODE. It works fine, but can only detect the controller if a button or a joystick was moved or pressed.
Is there anyway to check if a controller is connected?
input gdscript controller joystick control
You can use Input.get_connected_joysticks() and then look inside the array if there is a joystick. Also usefull for local multiplayer.
This event joy_connection_changed will also be usefull in some case.

Objective-c: Make a cocoa app to simulate media keys

I'm trying to simulate a press of this media buttons by code in a macbook:
The idea is to pause, rewind... the music with the uibuttons in my app. It's posible to do this? I did't find anything.
Something like this:
- (IBAction)playButtonClick:(id)sender {
//code here to play music, like if we pressed the physical play media key
}
I would draw images for that (probalby in two resolutions, one for retina and one for non-retina, while in most cases a retina version is sufficient) in two variations, one in regular mode and one as if the button is currently pressed.
Then use a simple UIButton object for each of them.
And right, when you create the buttons programmatically, then you can use
- (void)playButtonClick:(id)sender
as target for the play button. However, when you want to create and locate the buttons in Interface Builder or Storyboard Editor respectively, then it should be
- (IBAction)playButtonClick:(id)sender
which enables the IB to allow you to draw the connection to the action within IB accordingly.

How to cancel a drag in a Mac application

I have an application that has a canvas (NSView) where a user can drag an element around. When the mouse leaves the edge of that view it becomes a drag operation.
What I would like to do is when the mouse entered the originating view again it would cancel the operation and would automatically start the move within the canvas again.
I can figure out the second part I just need to figure out how to force a drag and drop to cancel. I need to do this somehow from draggingEntered: so before the mouse is even released.
Make your canvas view respond to drags as well. Initially all its <NSDraggingDestionation> protocol methods would just return “no, do nothing”, but if you start a drag from within the canvas you’d keep track of that, and once the drag leaves and comes back your NSDraggingDestionation methods would return, “Ok, we accept, drag is over, don’t bother animating.”
Then you could continue tracking locally. Like, assuming your canvas had called:
- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag;
That method would then return control to your canvas

Highlight Event

I'm using an UIImageView as a button with two different images on it, one normal, and another one when the image is clicked (highlighted). I've managed to create a Tap Gesture Recognizer and link it to the image so that when I click, highlights it and change the image, but how can I change it back to the first image when stop clicking? Should I use Long Press Gesture Recognizer?
Thanks
You can use UIButton, set its style to custom and set regular UIImages as normal/highlighted states directly from Interface Builder or programatically. There is no need to do overhead that way.

How to catch scrolling events in wxGTK?

I have a wxTextCtrl with a vertical scrollbar. I need to capture scroll events from the text control's scrollbar. I have a handler for EVT_SCROLL but it only gets invoked on the Windows build. On wxGTK it does nothing. Is there any way to make this work?
No, EVT_SCROLL, like many other events, only works for wxWidgets windows and not the native ones.
You can use wxRichTextCtrl or wxStyledTextCtrl but you probably won't find any way to be notified about scrolling in the native GTK+ text widget.