Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb
My Carrier: n/a

Double-tap time in Qt

Hi

 

Does anybody know if the time between screen taps that constitues a double-tap can be modified in a Qt application? Ideally, without modifying Qt itself :smileyhappy: Actually, modifying Qt isn't really a problem, since each application needs its own copy of the Qt libraries anyway. I just couldn't find where in the Qt code this was done. I'm not even sure whether Qt receives a specific double-tap event from the native event loop, or if it works out its own double-taps from the times between single-taps.

 

Best wishes

Kevin

 

 

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook
My Carrier: ...

Re: Double-tap time in Qt

Check the docs.

QApplication::setDoubleClickInterval

Cheers,

Jon

 

Please use plain text.
Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb
My Carrier: n/a

Re: Double-tap time in Qt

Thanks, but it didn't seem to make much difference for me. Does this method work for you?

 

To be honest, I have a suspicion that it's not the interval that makes the application seem insensitive to double-clicks, but how close together the screen taps have to be. I'm not sure what can be done about that.

Please use plain text.
Developer
connyhald
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook
My Carrier: *

Re: Double-tap time in Qt

If thats the issue, try this. It woks for QML Listviews, Buttons, etc. Not sure it works for double-tap as well, though.

 

QApplication app(argc, argv);

// Because of the hi-res BB10 display be need a higher tolerance to mouse movements
app.setStartDragDistance(16);
-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Please use plain text.
Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb
My Carrier: n/a

Re: Double-tap time in Qt

Hi

 

Thanks. This does seem to help a bit.

 

Best wishes

Kevin

Please use plain text.
Developer
trollixx
Posts: 60
Registered: ‎04-18-2012
My Device: BB10 Dev Alpha C
My Carrier: T-Mobile

Re: Double-tap time in Qt

[ Edited ]

I have the same problem, but using QApplication::setStartDragDistance() with high values isn't a good solution because it poors usability of Flickable-based components. So, I've done double tap handling on my own. Here's the code snippet, maybe you find it useful:

 

import QtQuick 1.1

Item {
    id: container

    signal clicked
    signal doubleClicked

    MouseArea {
        property double __clickTime: 0
        property int __mouseX: 0
        property int __mouseY: 0

        // Tune double tap here
        property int __doubleClickInterval: 400 // ms
    	property int __doubleClickDistance: 100 // px

        Timer {
            id: clickTimer
            interval: __doubleClickInterval
            onTriggered: {
                container.clicked()
                parent.__clickTime = 0
            }
        }

        onClicked: {
            // Handle single/double click on our own
            if (__clickTime === 0) {
                __clickTime = Date.now()
                clickTimer.start()
                __mouseX = mouse.x
                __mouseY = mouse.y
            } else if (Date.now() - __clickTime < __doubleClickInterval) {
                clickTimer.stop()
                __clickTime = 0
                if (Math.sqrt(Math.pow(__mouseX - mouse.x, 2) +
Math.pow(__mouseY - mouse.y, 2)) < __doubleClickDistance) { container.doubleClicked() } } } anchors.fill: parent } }

 

--
Oleg Shparber
Please use plain text.