diff --git a/src/texstudio.cpp b/src/texstudio.cpp index 25d2fe6cf7..da7a1d16d3 100644 --- a/src/texstudio.cpp +++ b/src/texstudio.cpp @@ -12116,6 +12116,45 @@ void Texstudio::updateStructureLocally(bool updateAll){ if(configManager.parseMaster && master && master->isHidden()){ showHiddenMasterFirst=true; } + // reorder documents + // on multi doc update only + if(!configManager.structureShowSingleDoc){ + for(int i=0;itopLevelItemCount();++j){ + QTreeWidgetItem *item = structureTreeWidget->topLevelItem(j); + document = static_cast(item->data(0,Qt::UserRole).value()); + if(document == documents.documents.value(i)){ + found=true; + break; + } + } + if(found && itakeTopLevelItem(j); + if(document==master){ + item->setIcon(0,getRealIcon("masterdoc")); + }else{ + item->setIcon(0,getRealIcon("doc")); + } + structureTreeWidget->insertTopLevelItem(i,item); + } + if(!found){ + QTreeWidgetItem *item=new QTreeWidgetItem(); + LatexDocument *doc=documents.documents.value(i); + + item->setText(0,doc->getFileInfo().fileName()); + item->setData(0,Qt::UserRole,QVariant::fromValue(static_cast(doc))); + if(doc==master){ + item->setIcon(0,getRealIcon("masterdoc")); + }else{ + item->setIcon(0,getRealIcon("doc")); + } + structureTreeWidget->insertTopLevelItem(i,item); + } + } + } for(LatexDocument *doc:docs){ bool hiddenMasterStructureIsVisible=false; @@ -12153,45 +12192,6 @@ void Texstudio::updateStructureLocally(bool updateAll){ } } } - // reorder documents - for(int i=0;itopLevelItemCount();++j){ - QTreeWidgetItem *item = structureTreeWidget->topLevelItem(j); - document = static_cast(item->data(0,Qt::UserRole).value()); - if(document == documents.documents.value(i)){ - found=true; - break; - } - } - if(found && itakeTopLevelItem(j); - if(document==master){ - item->setIcon(0,getRealIcon("masterdoc")); - }else{ - item->setIcon(0,getRealIcon("doc")); - } - structureTreeWidget->insertTopLevelItem(i,item); - } - if(!found){ - QTreeWidgetItem *item=new QTreeWidgetItem(); - LatexDocument *doc=documents.documents.value(i); - - item->setText(0,doc->getFileInfo().fileName()); - item->setData(0,Qt::UserRole,QVariant::fromValue(static_cast(doc))); - if(doc==master){ - item->setIcon(0,getRealIcon("masterdoc")); - }else{ - item->setIcon(0,getRealIcon("doc")); - } - structureTreeWidget->insertTopLevelItem(i,item); - if(doc==documents.getCurrentDocument()){ - root=item; - } - } - } } StructureEntry *selectedEntry=nullptr; bool itemExpandedLABEL=false;