src/main.cpp

changeset 274
1331aba5d36b
parent 272
9d52b119b3f5
child 278
304386ff96a4
--- a/src/main.cpp	Mon Jun 27 15:50:21 2022 +0300
+++ b/src/main.cpp	Mon Jun 27 15:55:27 2022 +0300
@@ -214,9 +214,16 @@
 	}
 }
 
-static QString title()
+static QString title(Ui_MainWindow* ui)
 {
-	return fullVersionString();
+	QMdiSubWindow* subWindow = ui->mdiArea->activeSubWindow();
+	QString titlestring;
+	if (subWindow != nullptr) {
+		return QObject::tr("%1 - %2").arg(subWindow->windowTitle(), fullVersionString());
+	}
+	else {
+		return fullVersionString();
+	}
 }
 
 static ColorTable loadColors(const LibrariesModel* libraries)
@@ -395,6 +402,9 @@
 		.circleToolOptions = new CircleToolOptionsWidget{&mainWindow},
 		.objectEditor = new ObjectEditor{&mainWindow},
 	};
+	const auto updateTitle = [&ui, &mainWindow]{
+		mainWindow.setWindowTitle(title(&ui));
+	};
 	const uiutilities::KeySequenceMap defaultKeyboardShortcuts =
 		uiutilities::makeKeySequenceMap(uiutilities::collectActions(&mainWindow));
 	const auto saveSettings = [&]{
@@ -687,6 +697,7 @@
 				}
 			}
 		}
+		updateTitle();
 	});
 	ui.messageLog->setModel(&messageLog);
 	QObject::connect(ui.actionAboutQt, &QAction::triggered, &app, &QApplication::aboutQt);
@@ -735,8 +746,8 @@
 	}
 	restoreSettings();
 	updateRenderPreferences(&ui, &renderPreferences, &documents);
-	mainWindow.setWindowTitle(title());
 	ui.actionAbout->setText(ui.actionAbout->text().arg(APPNAME));
+	updateTitle();
 	mainWindow.show();
 	const int result = app.exec();
 	saveSettings();

mercurial