KeyPress Event waits for MousePress Event qt -
so i'm writing qtwidget requires keyboard , mouse input overriding respective functions. keypress event doesnt happen until mousepress event occurs. i've played around focus bit , doesnt seem help. feel i'm missing regarding how qt processes events. can of fill me in. thank you
here think relevant bits of code. let me know if need more
meshtest::meshtest(qwidget *parent) : qglwidget(parent) { setfocuspolicy(qt::strongfocus); /* other stuff */ } void meshtest::mousepressevent(qmouseevent *event) { if (event->button() == qt::leftbutton) { /* math/ray casting here */ hashit = meshtest::findintersections(x,y,z,dirx,diry,dirz); } } void meshtest::mousereleaseevent(qmouseevent *event){ if (event->button() == qt::leftbutton) { /* ray casting stuff here */ } if(hashit) updategl(); } void meshtest::keypressevent(qkeyevent* event){ printf("key pressed\n"); //just debugging particular bug }
okay fixed few days ago. solution overide qwidget::event(qevent *event) , event handling in function itself
Comments
Post a Comment