Commit eed9ab29 authored by Leandro Melo's avatar Leandro Melo
Browse files

Editor: Update layout accordingly when restoring state

Whenever blocks are folded/unfoled we need to request a layout update.

Task-number: QTCREATORBUG-6666
Change-Id: I123b99c697a034cb04871bc41f42eac4f39895a2
Reviewed-by: default avatarDaniel Teske <>
Reviewed-by: default avatarEike Ziller <>
Reviewed-by: default avatarLeandro Melo <>
parent 8f206463
......@@ -2206,10 +2206,20 @@ bool BaseTextEditorWidget::restoreState(const QByteArray &state)
QList<int> collapsedBlocks;
stream >> collapsedBlocks;
QTextDocument *doc = document();
bool layoutChanged = false;
foreach(int blockNumber, collapsedBlocks) {
QTextBlock block = doc->findBlockByNumber(qMax(0, blockNumber));
if (block.isValid())
if (block.isValid()) {
BaseTextDocumentLayout::doFoldOrUnfold(block, false);
layoutChanged = true;
if (layoutChanged) {
BaseTextDocumentLayout *documentLayout =
QTC_ASSERT(documentLayout, return false);
} else {
if (d->m_displaySettings.m_autoFoldFirstComment)
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