Qt Utilities  5.6.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
recentmenumanager.h
Go to the documentation of this file.
1 #ifndef MISC_UTILS_RECENTMENUMANAGER_H
2 #define MISC_UTILS_RECENTMENUMANAGER_H
3 
4 #include "../global.h"
5 
6 #include <QObject>
7 
8 QT_FORWARD_DECLARE_CLASS(QMenu)
9 QT_FORWARD_DECLARE_CLASS(QAction)
10 
11 namespace MiscUtils {
12 
13 class QT_UTILITIES_EXPORT RecentMenuManager : public QObject
14 {
15  Q_OBJECT
16 
17 public:
18  RecentMenuManager(QMenu *menu, QObject *parent = nullptr);
19 
20 public Q_SLOTS:
21  void restore(const QStringList &savedEntries);
22  QStringList save();
23  void addEntry(const QString &path);
24  void clearEntries();
25 
26 Q_SIGNALS:
27  void fileSelected(const QString &path);
28 
29 private Q_SLOTS:
30  void handleActionTriggered();
31 
32 private:
33  QMenu *m_menu;
34  QAction *m_sep;
35  QAction *m_clearAction;
36 };
37 
38 }
39 
40 #endif // MISC_UTILS_RECENTMENUMANAGER_H
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
The RecentMenuManager class manages the entries for a "recently opened files" menu.