def set_layout_for_area(self, layout, q_dock_area,
                            _toplevel_added=False, _toplevel_call=True):
        """ Applies a LayoutItem to the specified dock area.
        """
        # If we try to do the layout bottom-up, Qt will become confused. In
        # order to do it top-down, we have know which dock widget is
        # "effectively" top level, requiring us to reach down to the leaves of
        # the layout. (This is really only an issue for Splitter layouts, since
        # Tabbed layouts are, for our purposes, leaves.)

        if isinstance(layout, PaneItem):
            if not _toplevel_added:
                widget = self._prepare_toplevel_for_item(layout)
                if widget:
                    self.control.addDockWidget(q_dock_area, widget)
                    widget.show()

        elif isinstance(layout, Tabbed):
            active_widget = first_widget = None
            for item in layout.items:
                widget = self._prepare_toplevel_for_item(item)
                if not widget:
                    continue
                if item.id < layout.active_tab:
                    active_widget = widget
                if first_widget:
                    self.control.tabifyDockWidget(first_widget, widget)
                else:
                    if not _toplevel_added:
                        self.control.addDockWidget(q_dock_area, widget)
                    first_widget = widget
                widget.show()

            # Activate the appropriate tab, if possible.
            if not active_widget:
                # By default, Qt will activate the last widget.
                active_widget = first_widget
            if active_widget:
                # It seems that the 'raise_' call only has an effect after the
                # QMainWindow has performed its internal layout.
                QtCore.QTimer.singleShot(0, active_widget.raise_)

        elif isinstance(layout, Splitter):
            # Perform top-level splitting as per above comment.
            orient = ORIENTATION_MAP[layout.orientation]
            prev_widget = None
            for item in layout.items:
                widget = self._prepare_toplevel_for_item(item)
                if not widget:
                    continue
                if prev_widget:
                    self.control.splitDockWidget(prev_widget, widget, orient)
                elif not _toplevel_added:
                    self.control.addDockWidget(q_dock_area, widget)
                prev_widget = widget
                widget.show()

            # Now we can recurse.
            for i, item in enumerate(layout.items):
                self.set_layout_for_area(item, q_dock_area,
                    _toplevel_added=True, _toplevel_call=False)

        else:
            raise MainWindowLayoutError("Unknown layout item %r" % layout)

        # Remove the fixed sizes once Qt activates the layout.
        if _toplevel_call:
            QtCore.QTimer.singleShot(0, self._reset_fixed_sizes)

    ###########################################################################
    # 'MainWindowLayout' abstract interface.
    ###########################################################################
dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/tasks/main_window_layout.py/MainWindowLayout.set_layout_for_area/operator `==` -> `<`