Results 1 to 2 of 2

Thread: Passing event to parent

  1. #1
    QPissedOff Guest

    Default Passing event to parent

    Hi all,
    I have a widget (OpArea) that reimplements QWidget's wheelEvent handler. The parent of this widget is a scrollArea. I need the wheelEvent of OpArea to be called and under certain circumstances (no Alt modifier) the event needs to be propagated to the parent, to scroll the window.

    Qt Code:
    1. void OpArea::wheelEvent(QWheelEvent *event)
    2. {
    3. if(event->modifiers() == Qt::AltModifier)
    4. {
    5. //handle the event in OpArea
    6. static int theta = 0;
    7. if (event->delta()>=0)
    8. {
    9. theta= theta +20;
    10. }
    11. else
    12. theta = theta -20;
    13.  
    14. if (theta <0)
    15. theta = 340;
    16. if (theta> 340)
    17. theta = 0;
    18. cout << theta <<endl;
    19. }
    20. else
    21. {
    22. //send to parent's wheelEvent...
    23. }
    24.  
    25. }
    To copy to clipboard, switch view to plain text mode 

    I think i should be using QApplication::notify() or maybe postEvent() but I am not sure exactly how.... I would appreciate any ideas, thanks

  2. #2
    QPissedOff Guest

    Default Re: Passing event to parent

    nevermind, I used event->ignore() to send the event up the chain to the parent.
    thanks anyway..

Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Custom event gets not propagated to the top level widget
    By nightghost in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2009, 09:06
  3. parent widet does not get mouse event.
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 27th July 2008, 08:43
  4. how to call parent widget's event ?
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2007, 12:39
  5. How to prevent Event Propagation to Parent?
    By viking in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2007, 06:29

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.