Qt Utilities 6.14.3
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
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
8QT_FORWARD_DECLARE_CLASS(QMenu)
9QT_FORWARD_DECLARE_CLASS(QAction)
10
11namespace QtUtilities {
12
13class QT_UTILITIES_EXPORT RecentMenuManager : public QObject {
14 Q_OBJECT
15
16public:
17 RecentMenuManager(QMenu *menu, QObject *parent = nullptr);
18
19public Q_SLOTS:
20 void restore(const QStringList &savedEntries);
21 QStringList save();
22 void addEntry(const QString &path);
23 void clearEntries();
24
25Q_SIGNALS:
26 void fileSelected(const QString &path);
27
28private Q_SLOTS:
29 void handleActionTriggered();
30
31private:
32 QMenu *m_menu;
33 QAction *m_sep;
34 QAction *m_clearAction;
35};
36} // namespace QtUtilities
37
38#endif // MISC_UTILS_RECENTMENUMANAGER_H
The RecentMenuManager class manages the entries for a "recently openedfiles" menu.
void fileSelected(const QString &path)
Emitted after the user selected a file.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14