Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-14879

Cocoa: parented QMainWindows move with their parents, are always frontmost

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • Some future release
    • 4.7.0
    • Widgets: Main Window
    • None
    • Mac OS X 10.6.4, Qt 4.7.0 Cocoa, 32-bit mode.

    Description

      Repro:

      Using the Cocoa version of Qt, create two different QMainWindow classes. Instantiate and show an instance of one as the application's main window, then instantiate and show an instance of the other as a child of the first (e.g., "QMainWindow* win = new ChildWindow(this)"). Now, click on the title bar of the main window. Observe that although the main window becomes active, it does not come to the front. Drag the title bar of the main window to move it, and observe that the child window also moves.

      This bug does not occur in the Carbon version.

      Discussion:

      It looks like someone is calling -[NSWindow addChildWindow:ordered:] when the child QMainWindow is parented. From Apple's NSWindow documentation:

      After the childWindow is added as a child of the window, it is maintained in relative position indicated by orderingMode for subsequent ordering operations involving either window. While this attachment is active, moving childWindow will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause childWindow to move.

      This matches the buggy behavior exactly. There is no good reason I can think of to call this method for anything other than a drawer window, so you can probably just remove that call and the bug will go away.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            richard Richard Moe Gustavsen
            phoenix1701 Brian Ellis
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes