Results 1 to 8 of 8

Thread: QMdiArea unwanted actvation

Threaded View

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

    Default Re: QMdiArea unwanted actvation

    Quote Originally Posted by fullmetalcoder View Post
    Just to make sure the problem does not come from my code I checked another app using the same QMdiArea nesting and was able to reproduce the bug...
    I somehow expected this to be a minimal compilable example or something like that.

    Does anyone have a magic trick or do I need to go on the tracker and wait for a couple of releases to have it fixed?
    The "magic trick" goes here:
    Qt Code:
    1. class InnerMdiArea : public QMdiArea
    2. {
    3. public:
    4. InnerMdiArea(QWidget* parent = 0)
    5. : QMdiArea(parent) { }
    6.  
    7. bool eventFilter(QObject* object, QEvent* event)
    8. {
    9. return event->type() == QEvent::ApplicationActivate
    10. || event->type() == QEvent::ApplicationDeactivate;
    11. }
    12. };
    To copy to clipboard, switch view to plain text mode 
    As the class name suggests, use this as the inner MDI area and everything should be fine.

    PS. The reason this works is that QMdiArea installs an event filter on QApplication and QObject::eventFilter() is virtual..
    J-P Nurmi

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

    fullmetalcoder (10th November 2007)

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.