EditorView *EditorView::findNextView() { SplitterOrView *current = parentSplitterOrView(); QTC_ASSERT(current, return this); SplitterOrView *parent = current->findParentSplitter(); while (parent) { QSplitter *splitter = parent->splitter(); QTC_ASSERT(splitter, return this); QTC_ASSERT(splitter->count() == 2, return this); // is current the first child? then the next view is the first one in current's sibling if (splitter->widget(0) == current) { SplitterOrView *second = qobject_cast<SplitterOrView *>(splitter->widget(1)); QTC_ASSERT(second, return this); return second->findFirstView(); } // otherwise go up the hierarchy current = parent; parent = current->findParentSplitter(); }