Core: Fix wrong current view after session restore

Fixes: QTCREATORBUG-23233
Change-Id: I4e5a854769d6aa00f5601b8bd8282523681d0458
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Sergey Morozov
2019-11-17 12:23:22 +03:00
parent 02b7a529dd
commit 78012fcb66
2 changed files with 5 additions and 4 deletions

View File

@@ -713,7 +713,7 @@ EditorView *SplitterOrView::takeView()
return oldView;
}
void SplitterOrView::split(Qt::Orientation orientation)
void SplitterOrView::split(Qt::Orientation orientation, bool activateView)
{
Q_ASSERT(m_view && m_splitter == nullptr);
m_splitter = new MiniSplitter(this);
@@ -744,7 +744,8 @@ void SplitterOrView::split(Qt::Orientation orientation)
otherView->view()->setCloseSplitIcon(Utils::Icons::CLOSE_SPLIT_BOTTOM.icon());
}
EditorManagerPrivate::activateView(otherView->view());
if (activateView)
EditorManagerPrivate::activateView(otherView->view());
emit splitStateChanged();
}
@@ -911,7 +912,7 @@ void SplitterOrView::restoreState(const QByteArray &state)
qint32 orientation;
QByteArray splitter, first, second;
stream >> orientation >> splitter >> first >> second;
split((Qt::Orientation)orientation);
split((Qt::Orientation) orientation, false);
m_splitter->restoreState(splitter);
static_cast<SplitterOrView*>(m_splitter->widget(0))->restoreState(first);
static_cast<SplitterOrView*>(m_splitter->widget(1))->restoreState(second);

View File

@@ -171,7 +171,7 @@ public:
explicit SplitterOrView(EditorView *view);
~SplitterOrView() override;
void split(Qt::Orientation orientation);
void split(Qt::Orientation orientation, bool activateView = true);
void unsplit();
inline bool isView() const { return m_view != nullptr; }