PDA

View Full Version : Touchscreen doble click problem



pablo7
11th August 2009, 12:22
I am developing a graphic interface in a touch screen with QtCreator.

I have implemented a graphic keyboard to add characters to certein text filds, where every key is a QPushButton class.

The problem is when I press some key, the button event function [click( )] is called twice. What event could I used to add a single letter when I push a single key?

Thanks.

yogeshgokul
11th August 2009, 13:56
What event could I used to add a single letter when I push a single key?
You have to use QKeyEvent.

pablo7
12th August 2009, 09:39
Thank yogeshgokul, but I think QKeyEvent is used when I utilize real keyboard, but in my case I'm using virtual keyboard in a touchscreen like this image.
I don't know what event or function I have to use to call my function of QPushButton once instead of twice.

Thanks

h123
12th August 2009, 09:50
Hi pablo7,
You can try to catch the QTouchEvent and then filter required events.
Thanks.

yogeshgokul
12th August 2009, 10:26
I think QKeyEvent is used when I utilize real keyboard, but in my case I'm using virtual keyboard
QKeyEvent is your solution.


I don't know what event or function I have to use to call my function of QPushButton once instead of twice.
When you press a mouse left button on any part of this image. Say you clicked on "A". So, in mouse click event you have to do like this.


QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier);
QApplication::sendEvent(parent->focusWidget(), &event);

Using this approach, I also created a virtual keyboard. But I was using QToolButtons instead of an Image. Please see the attached screen shot.

pablo7
13th August 2009, 09:14
Thanks yogeshgokul. It looks a good idea, I will try it.