RENOLD
10th February 2012, 08:38
I am working on this code:
void widget::keyPressEvent (QKeyEvent *e)
{
if(e->key()==Qt::Key_N)
{
function1();
}
}
void widget::keyReleaseEvent (QKeyEvent *r)
{
if(r->key()==Qt::Key_N)
{
function2();
}
}
.
.
.
It means when i press N key my function1() has to call, and when I release N key my function2() has to call. I want to make such that kind of application in which I have to continuously press N key and function 1 will continuously call, and when I release this N key only one time my function2() will call.
Now I am continuously pressing the N key.
But the problem is that my function2() is also continuously called still I haven't release the N key.
Please give your suggestion which will be helpful to me.
:)
void widget::keyPressEvent (QKeyEvent *e)
{
if(e->key()==Qt::Key_N)
{
function1();
}
}
void widget::keyReleaseEvent (QKeyEvent *r)
{
if(r->key()==Qt::Key_N)
{
function2();
}
}
.
.
.
It means when i press N key my function1() has to call, and when I release N key my function2() has to call. I want to make such that kind of application in which I have to continuously press N key and function 1 will continuously call, and when I release this N key only one time my function2() will call.
Now I am continuously pressing the N key.
But the problem is that my function2() is also continuously called still I haven't release the N key.
Please give your suggestion which will be helpful to me.
:)