forked from qt-creator/qt-creator
DiffEditor: Fix selection of next view
Change-Id: I3754bb3637fc89d4c9ef2939db25dd1fda9d3243 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
This commit is contained in:
committed by
Jarek Kobus
parent
f9f6f0b2c9
commit
3232af6272
@@ -202,7 +202,7 @@ DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
|
|||||||
: m_document(doc)
|
: m_document(doc)
|
||||||
, m_descriptionWidget(0)
|
, m_descriptionWidget(0)
|
||||||
, m_stackedWidget(0)
|
, m_stackedWidget(0)
|
||||||
, m_currentViewIndex(0)
|
, m_currentViewIndex(-1)
|
||||||
, m_guiController(0)
|
, m_guiController(0)
|
||||||
, m_toolBar(0)
|
, m_toolBar(0)
|
||||||
, m_entriesComboBox(0)
|
, m_entriesComboBox(0)
|
||||||
@@ -516,6 +516,8 @@ void DiffEditor::addView(IDiffView *view)
|
|||||||
|
|
||||||
IDiffView *DiffEditor::currentView() const
|
IDiffView *DiffEditor::currentView() const
|
||||||
{
|
{
|
||||||
|
if (m_currentViewIndex < 0)
|
||||||
|
return 0;
|
||||||
return m_views.at(m_currentViewIndex);
|
return m_views.at(m_currentViewIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,11 +530,11 @@ void DiffEditor::setCurrentView(IDiffView *view)
|
|||||||
|
|
||||||
IDiffView *DiffEditor::nextView()
|
IDiffView *DiffEditor::nextView()
|
||||||
{
|
{
|
||||||
++m_currentViewIndex;
|
int pos = m_currentViewIndex + 1;
|
||||||
if (m_currentViewIndex >= m_views.count())
|
if (pos >= m_views.count())
|
||||||
m_currentViewIndex = 0;
|
pos = 0;
|
||||||
|
|
||||||
return currentView();
|
return m_views.at(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffEditor::showDiffView(IDiffView *newView)
|
void DiffEditor::showDiffView(IDiffView *newView)
|
||||||
@@ -542,7 +544,8 @@ void DiffEditor::showDiffView(IDiffView *newView)
|
|||||||
if (currentView() == newView)
|
if (currentView() == newView)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
currentView()->setDiffEditorGuiController(0);
|
if (currentView()) // during initialization
|
||||||
|
currentView()->setDiffEditorGuiController(0);
|
||||||
setCurrentView(newView);
|
setCurrentView(newView);
|
||||||
currentView()->setDiffEditorGuiController(m_guiController);
|
currentView()->setDiffEditorGuiController(m_guiController);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user