Results 1 to 2 of 2

Thread: Custom QEvents not propagating to the top widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Qt products
    Platforms
    Unix/X11

    Default Custom QEvents not propagating to the top widget

    I've noticed that the custom QEvents(QEvents subclasses or simply events created with a User-type) are not propagated to the top widget...
    This is a pain in the neck for me since if i don't want to do something like:
    Qt Code:
    1. par = self.parent().parent().parent().parent()...so on...
    2. qApp.postEvent(par,event)
    To copy to clipboard, switch view to plain text mode 
    (I'm writing using python, translate "self" with "this" and "." with -> or :: and it's the same as C++ code)

    I thought that every QWidget subclass wouldn't accept User-type QEvents since if they do so they block the propagation of the event doing nothing(which is completely useless...)

    Any (other) solution for this?

  2. #2
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Qt products
    Platforms
    Unix/X11

    Default Re: Custom QEvents not propagating to the top widget

    Maybe i couldn't make me understand...
    Quote Originally Posted by Qt documentation
    bool QWidget::event ( QEvent * event ) [virtual protected]

    This is the main event handler; it handles event event. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

    Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().

    Mouse and tablet event handling is also slightly special: only when the widget is enabled, event() will call the specialized handlers such as mousePressEvent(); otherwise it will discard the event.

    This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.
    tell me why the above documentations is completely wrong.
    The QEvent is accepted even if it isn't recognized and this is a big misfeature of qt(since it seems like it doesn't work the way the documentation tells...)

Similar Threads

  1. How to use custom widget editor with QItemDelegate
    By wysman in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2009, 18:20
  2. Custom Widget - First Steps
    By sekatsim in forum Qt Programming
    Replies: 8
    Last Post: 26th June 2008, 17:19
  3. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  4. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  5. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12

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
  •  
Qt is a trademark of The Qt Company.