PDA

View Full Version : Setting event priority in QT



sanujas
26th November 2013, 13:11
Hi,

i would like to know thru' example how to use QT::Event Priority. I read QT documentation but couldn't come to know how to use it.

or how to set priority for events in QT?

e.g. if there are 3 events:
1.button clicked
2. paint event
3. timer event

now how to set highest priority to button clicked event?


Thanks,
sanujas

Santosh Reddy
28th November 2013, 06:51
now how to set highest priority to button clicked event?
You can set event priority if you are generating the button click event using QCoreApplication::postEvent() API. You cannot set the priority of the events generated internally by Qt Framework.

BTW it is very rarely required to bother about the event priority, why do you want to change the priority?

sanujas
28th November 2013, 11:50
Hi,

Thanks for the reply.
Actually when i am connecting touch screen lcd i am not getting button responce if screen refresh rate is faster say 1sec.It's mainly happening since it is busy with paint event.so i thought if i set paintevent priority lowest then that problem might not occur.Anyway it seems lcd touch sensing related issue only.
how to test paintevent execution time thru' QT?


Thanks,
sanujas

Santosh Reddy
28th November 2013, 12:37
Actually when i am connecting touch screen lcd i am not getting button responce if screen refresh rate is faster say 1sec.It's mainly happening since it is busy with paint event.so i thought if i set paintevent priority lowest then that problem might not occur.
Setting the priority (even if it were possible) will not help in your case because once paint event has started execution another event will not be processed until paint event is finished.


how to test paintevent execution time thru' QT?
You can use QTimer.


void Widget::paintevent(QPaintEvent * event)
{
QTime t;
t.start();

....//Painting code

qDebug() << t.elapsed(); //time in milliseconds.
}