def get_layout_for_area(self, q_dock_area, include_sizes=True):
        # Build the initial set of leaf-level items.
        items = set()
        rects = {}
        for child in self.control.children():
            # Iterate through *visibile* dock widgets. (Inactive tabbed dock
            # widgets are "visible" but have invalid positions.)
            if isinstance(child, QtGui.QDockWidget) and child.isVisible() and \
                   self.control.dockWidgetArea(child) == q_dock_area and \
                   child.x() >= 0 and child.y() >= 0:
                # Get the list of dock widgets in this tab group in order.
                geometry = child.geometry()
                tabs = [ tab for tab in self.control.tabifiedDockWidgets(child)
                         if tab.isVisible() ]
                if tabs:
                    tab_bar = self._get_tab_bar(child)
                    tab_index = tab_bar.currentIndex()
                    tabs.insert(tab_index, child)
                    geometry = tab_bar.geometry().united(geometry)

                # Create the leaf-level item for the child.
                if tabs:
                    panes = [ self._prepare_pane(dock_widget, include_sizes)
                              for dock_widget in tabs ]
                    item = Tabbed(*panes, active_tab=panes[tab_index].id)
                else:
                    item = self._prepare_pane(child, include_sizes)
                items.add(item)
                rects[item] = geometry

        # Build the layout tree bottom-up, in multiple passes.
        while len(items) > 1:
            add, remove = set(), set()

            for item1, item2 in combinations(items, 2):
                if item1 not in remove and item2 not in remove:
                    rect1, rect2 = rects[item1], rects[item2]
                    orient = self._get_division_orientation(rect1, rect2, True)
                    if orient == QtCore.Qt.Horizontal:
                        if rect1.y() < rect2.y():
                            item = VSplitter(item1, item2)
                        else:
                            item = VSplitter(item2, item1)
                    elif orient == QtCore.Qt.Vertical:
                        if rect1.x() < rect2.x():
                            item = HSplitter(item1, item2)
                        else:
                            item = HSplitter(item2, item1)
                    else:
                        continue
                    rects[item] = rect1.united(rect2)
                    add.add(item)
                    remove.update((item1, item2))

            if add or remove:
                items.update(add)
                items.difference_update(remove)
            else:
                # Raise an exception instead of falling into an infinite loop.
                raise RuntimeError('Unable to extract layout from QMainWindow.')

        if items:
            return items.pop()
        return None
Gets a LayoutItem for the specified dock area.
dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/tasks/main_window_layout.py/MainWindowLayout.get_layout_for_area