Results 1 to 6 of 6

Thread: Pass mouseEvent to sibling widget?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Pass mouseEvent to sibling widget?

    Two options:
    1. Reimplement mouse events for A and resend the event to B instead of ignoring it in A
    2. Install an event filter on A to forward events to B, there check if the event is in the transparent area and handle it there and then return true so that A doesn't get the event.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    nish (1st September 2009)

  3. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Pass mouseEvent to sibling widget?

    thank you guruji for your reply..

    both the options you suggested are same as the some i was thinking of...
    i am thinking that in the mouseEvents handlers of "P" i check wether the pos() of click comes in geometry of "B", then manually postEvent() a new mouseEvent to "B"...
    so in all the three cases i have to postEvent() a new mouseEvent to "B"... ... so now as i got the confirmation of the guru.. i will go with it... ...

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Pass mouseEvent to sibling widget?

    sendEvent(), not postEvent().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Pass mouseEvent to sibling widget?

    postEvent()
    Adds the event event, with the object receiver as the receiver of the event, to an event queue and returns immediately.
    hmm... looking at the documentation.. i would prefer postevent so that it does not block anything... why you suggested sendEvent()? any specific reason that i may be ignoring?

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Pass mouseEvent to sibling widget?

    It won't block anything. I suggest sendEvent because you can reuse the same object you got from Qt instead of creating a copy of a specific QEvent subclass (which might be hard in itself). And someone might assume when the event to B is delivered, it will be handled, not that it will be handled later.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Widget Focus
    By navi1084 in forum Qt Programming
    Replies: 6
    Last Post: 29th September 2008, 10:22
  3. pass mouse event information to another widget
    By Rooster in forum Qt Programming
    Replies: 5
    Last Post: 12th July 2008, 04:23
  4. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  5. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35

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.