Results 1 to 4 of 4

Thread: Setting event priority in QT

  1. #1
    Join Date
    Jan 2013
    Posts
    22
    Thanked 3 Times in 2 Posts
    Qt products
    Qt/Embedded

    Default Setting event priority in QT

    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

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Setting event priority in QT

    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:ostEvent() 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?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2013
    Posts
    22
    Thanked 3 Times in 2 Posts
    Qt products
    Qt/Embedded

    Default Re: Setting event priority in QT

    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

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Setting event priority in QT

    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.
    Qt Code:
    1. void Widget::paintevent(QPaintEvent * event)
    2. {
    3. QTime t;
    4. t.start();
    5.  
    6. ....//Painting code
    7.  
    8. qDebug() << t.elapsed(); //time in milliseconds.
    9. }
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. QUdpSocket and priority
    By Pavlya in forum Qt Programming
    Replies: 5
    Last Post: 11th April 2013, 07:32
  2. Replies: 1
    Last Post: 14th February 2011, 04:30
  3. Qt thread priority
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2010, 01:39
  4. Timer event & paint event, priority
    By Teuniz in forum Qt Programming
    Replies: 0
    Last Post: 2nd February 2010, 13:33
  5. priority of QThread
    By quickNitin in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2006, 12:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.