--- a/src/main.cpp Sun Jul 03 23:54:22 2022 +0300 +++ b/src/main.cpp Mon Jul 04 00:19:18 2022 +0300 @@ -333,6 +333,15 @@ } } +static QFont monospace() +{ + QFont font{"Monospace"}; + font.setStyleHint(QFont::TypeWriter); + font.setPointSize(10); + font.setFixedPitch(true); + return font; +} + constexpr bool sortModelIndexesByRow(const QModelIndex& a, const QModelIndex& b) { return a.row() < b.row(); @@ -429,11 +438,6 @@ MessageLog messageLog; Signal settingsChanged; ui.setupUi(&mainWindow); - QFont monospace{"Monospace"}; - monospace.setStyleHint(QFont::TypeWriter); - monospace.setPointSize(10); - monospace.setFixedPitch(true); - ui.modelEdit->setFont(monospace); ToolWidgets toolWidgets{ .circleToolOptions = new CircleToolOptionsWidget{&mainWindow}, .objectEditor = new ObjectEditor{&mainWindow}, @@ -526,6 +530,7 @@ ::save(*model, &stream); data->textbuffer = std::make_unique<QTextDocument>(); data->textbuffer->setPlainText(modeltext); + data->textbuffer->setDefaultFont(monospace()); data->textbuffer->setDocumentLayout(new QPlainTextDocumentLayout(data->textbuffer.get())); data->textcursor = std::make_unique<QTextCursor>(data->textbuffer.get()); documents.setModelPayload(modelId, data); @@ -776,6 +781,7 @@ QTextStream stream{&text}; Parser parser(stream); parser.parseBody(*data->model); + documents.loadDependenciesForAllModels(libraries); data->canvas->update(); } });