diff -r 235941b7322f -r 37f936073cac src/mainwindow.cpp --- a/src/mainwindow.cpp Tue Sep 28 23:09:09 2021 +0300 +++ b/src/mainwindow.cpp Sun Oct 24 11:33:32 2021 +0300 @@ -209,6 +209,26 @@ return qobject_cast(this->ui->tabs->currentWidget()); } +void MainWindow::closeDocument(Document *document) +{ + const int tabIndex = this->ui->tabs->indexOf(document); + if (tabIndex != -1) + { + this->ui->tabs->removeTab(tabIndex); + const QString closedDocumentName = pathToName(document->modelPath()); + delete document; + } + QSet openedDocumentNames; + for (int i = 0; i < this->ui->tabs->count(); i += 1) + { + Document* document = qobject_cast(this->ui->tabs->widget(i)); + if (document != nullptr) + { + openedDocumentNames.insert(pathToName(document->modelPath())); + } + } +} + void MainWindow::handleDocumentSplitterChange() { Document* currentDocument = this->currentDocument();