forked from qt-creator/qt-creator
reduce startup flicker with editor toolbars.
This commit is contained in:
@@ -871,6 +871,7 @@ IEditor *EditorManager::openEditor(const QString &fileName, const QString &edito
|
||||
restoreEditorState(editor);
|
||||
QApplication::restoreOverrideCursor();
|
||||
ensureEditorManagerVisible();
|
||||
setCurrentEditor(editor);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -1351,6 +1352,8 @@ bool EditorManager::restoreState(const QByteArray &state)
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
bool editorChangesSuppressed = m_d->m_suppressEditorChanges;
|
||||
m_d->m_suppressEditorChanges = true;
|
||||
|
||||
@@ -1367,6 +1370,8 @@ bool EditorManager::restoreState(const QByteArray &state)
|
||||
if (currentEditor())
|
||||
setCurrentEditor(currentEditor());// looks like a null-op but is not
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,12 +225,11 @@ void StackedEditorGroup::insertEditor(int index, IEditor *editor)
|
||||
m_widgetEditorMap.insert(editor->widget(), editor);
|
||||
|
||||
QToolBar *toolBar = editor->toolBar();
|
||||
if (toolBar)
|
||||
if (toolBar) {
|
||||
toolBar->setVisible(false); // will be made visible in setCurrentEditor
|
||||
m_toolBar->layout()->addWidget(toolBar);
|
||||
connect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
|
||||
|
||||
updateEditorStatus(editor);
|
||||
updateToolBar(editor);
|
||||
}
|
||||
connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
|
||||
|
||||
emit editorAdded(editor);
|
||||
}
|
||||
@@ -284,23 +283,26 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
||||
const bool block = m_editorList->blockSignals(true);
|
||||
m_editorList->setCurrentIndex(indexOf(editor));
|
||||
m_editorList->blockSignals(block);
|
||||
}
|
||||
setEditorFocus(idx);
|
||||
|
||||
updateEditorStatus(editor);
|
||||
updateToolBar(editor);
|
||||
}
|
||||
setEditorFocus(idx);
|
||||
if (editor != m_editorForInfoWidget) {
|
||||
m_infoWidget->hide();
|
||||
m_editorForInfoWidget = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void StackedEditorGroup::checkEditorStatus()
|
||||
{
|
||||
IEditor *editor = qobject_cast<IEditor *>(sender());
|
||||
if (editor == currentEditor())
|
||||
updateEditorStatus(editor);
|
||||
}
|
||||
|
||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
||||
{
|
||||
if (!editor)
|
||||
editor = qobject_cast<IEditor *>(sender());
|
||||
QTC_ASSERT(editor, return);
|
||||
|
||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
||||
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
||||
|
||||
@@ -325,8 +327,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor)
|
||||
toolBar = m_defaultToolBar;
|
||||
if (m_activeToolBar == toolBar)
|
||||
return;
|
||||
m_activeToolBar->setVisible(false);
|
||||
toolBar->setVisible(true);
|
||||
m_activeToolBar->setVisible(false);
|
||||
m_activeToolBar = toolBar;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ protected:
|
||||
private slots:
|
||||
void sendCloseRequest();
|
||||
void updateEditorStatus(Core::IEditor *editor = 0);
|
||||
void checkEditorStatus();
|
||||
void setEditorFocus(int index);
|
||||
void makeEditorWritable();
|
||||
void listSelectionChanged(int index);
|
||||
|
||||
Reference in New Issue
Block a user