ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvRecentFiles.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <QObject>
11 
12 class QAction;
13 class QMenu;
14 class QString;
15 #include <QStringList> // QStringList is a type alias in Qt6, cannot forward declare
16 
17 class ecvRecentFiles : public QObject {
18  Q_OBJECT
19 
20 public:
21  ecvRecentFiles(QWidget *parent);
22 
24  QMenu *menu();
25 
27  void addFilePath(const QString &filePath);
28 
29 private:
31  void updateMenu();
32 
34  void openFileFromAction();
35 
38  QStringList listRecent();
39 
41  QString contractFilePath(const QString &filePath);
42 
44  QString expandFilePath(const QString &filePath);
45 
47  static QString s_settingKey;
48 
49  QMenu *m_menu;
50 
51  QAction *m_actionClearMenu;
52 };
QMenu * menu()
Returns a "most recently used file" menu.
ecvRecentFiles(QWidget *parent)
void addFilePath(const QString &filePath)
Adds a file path to the recently used menu.