Results 1 to 7 of 7

Thread: MSG not defined (winEvent)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2006
    Posts
    68
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MSG not defined (winEvent)

    Hi Jpn,

    I tied that.. but now just about everything has stopped working.. I tried returning both true and false, but still the main UI doesn't seem to draw, the close buttons etc don't work.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: MSG not defined (winEvent)

    Quote Originally Posted by December View Post
    I tied that.. but now just about everything has stopped working.. I tried returning both true and false, but still the main UI doesn't seem to draw, the close buttons etc don't work.
    The event must be passed to the base class implementation so that the event gets further delivered to the correct specialized event handler. For example:
    Qt Code:
    1. bool MyWidget::event(QEvent* e)
    2. {
    3. if (e->type() == QEvent::WindowStateChange)
    4. {
    5. // minimized, maximized or fullscreen state changed, do something..
    6. }
    7. return QWidget::event(e); // <-- important
    8. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    December (19th February 2007)

  4. #3
    Join Date
    Sep 2006
    Posts
    68
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MSG not defined (winEvent)

    That was it.. thanks loads

    I had just about figure out that I could do it using an Event filter.. which is the better approach?

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: MSG not defined (winEvent)

    Quote Originally Posted by December View Post
    I had just about figure out that I could do it using an Event filter.. which is the better approach?
    Sure, both ways work. It's just a matter of taste. Overriding an event handler in most cases results into a cleaner solution than installing an event filter. Installing an event filter might save you from subclassing but the functionality ends up into a "wrong" class..
    J-P Nurmi

Similar Threads

  1. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  2. is it possible to stay on a user defined infinite loop?
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 24th March 2006, 14:29
  3. Replies: 25
    Last Post: 15th January 2006, 00: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
  •  
Qt is a trademark of The Qt Company.