Results 1 to 3 of 3

Thread: Mouse event with some delay

  1. #1
    Join Date
    Jul 2012
    Posts
    14
    Thanked 1 Time in 1 Post
    Platforms
    Unix/X11 Windows

    Default Mouse event with some delay

    -hi,

    i am making an one class(say my_class) which inherited QPushButton class.... i want to custmize events pass to my_class object...
    when i press that button it will generate press and show button image of pressbutton.jpg from style sheet but after some time it will generate release event and show button image of releasebutton.jpg from style sheet..

    i want press button and release button event with customizations.... means first press event got update button image and after some time release event generates and image changes back to ideal states.

  2. #2
    Join Date
    Sep 2011
    Posts
    26
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Mouse event with some delay

    You can use Qtimer for a delay.

  3. #3
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Mouse event with some delay

    You will have to overwrite mousePressEvent ( QMouseEvent * e ) and mouseReleaseEvent ( QMouseEvent * e )
    and add a timer to the mousePressEvent when the timer (QTimer::singleshot) timesout you can send a mouseRelease event by using QApplication::sendEvent(QObject *receiver, QEvent *event); or QApplication:ostEvent(QObject *receiver, QEvent *event, int prio)

Similar Threads

  1. Ogre+qt mouse event (add object with mouse problem)
    By rimie23 in forum Qt Programming
    Replies: 7
    Last Post: 24th April 2012, 11:49
  2. Replies: 14
    Last Post: 17th January 2012, 10:01
  3. Replies: 3
    Last Post: 7th January 2012, 09:38
  4. Mouse Event - source of event?
    By PowerPlate in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2011, 10:46
  5. Replies: 3
    Last Post: 12th May 2010, 14:11

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.