src/mainwindow.cpp

changeset 361
c5e8b68e34f8
parent 355
e81f4ad53efd
child 362
e1d646a4cbd8
--- a/src/mainwindow.cpp	Sun Apr 09 12:23:32 2023 +0300
+++ b/src/mainwindow.cpp	Sun Apr 09 13:28:36 2023 +0300
@@ -87,3 +87,16 @@
 	dialog.setWindowTitle(QObject::tr("About %1").arg(CMAKE_PROJECT_NAME));
 	dialog.exec();
 }
+
+void MainWindow::rebuildRecentFilesMenu(const QStringList& strings)
+{
+	this->menuRecentFiles->clear();
+	for (const QString& path : strings)
+	{
+		QAction* action = new QAction{path, this};
+		this->menuRecentFiles->addAction(action);
+		connect(action, &QAction::triggered, [&, path]{
+			Q_EMIT this->recentFileSelected(path);
+		});
+	}
+}

mercurial