Commit acad0e34 authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Simplify code / Adapt to recursion

parent 84f52870
...@@ -400,23 +400,12 @@ QPoint Konsole::ViewSplitter::mapToTopLevel(const QPoint& p) ...@@ -400,23 +400,12 @@ QPoint Konsole::ViewSplitter::mapToTopLevel(const QPoint& p)
QPoint Konsole::ViewSplitter::mapFromTopLevel(const QPoint& p) QPoint Konsole::ViewSplitter::mapFromTopLevel(const QPoint& p)
{ {
QStack<ViewSplitter*> tillTopLevel;
tillTopLevel.push(this);
auto parentSplitter = qobject_cast<ViewSplitter*>(parent()); auto parentSplitter = qobject_cast<ViewSplitter*>(parent());
while(parentSplitter) { if (parentSplitter) {
tillTopLevel.push(parentSplitter); return mapFromParent(parentSplitter->mapFromTopLevel(p));
parentSplitter = qobject_cast<ViewSplitter*>(parentSplitter->parent());
}
tillTopLevel.pop();
QPoint retPoint = p;
while (!tillTopLevel.isEmpty()) {
ViewSplitter *view = tillTopLevel.pop();
retPoint = view->mapFromParent(retPoint);
} }
return retPoint; return p;
} }
Konsole::ViewSplitterHandle::ViewSplitterHandle(Qt::Orientation orientation, QSplitter* parent) Konsole::ViewSplitterHandle::ViewSplitterHandle(Qt::Orientation orientation, QSplitter* parent)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment