Qt Utilities: misc/recentmenumanager.h Source File

Qt Utilities 6.20.0 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
13 class 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
QtUtilities::RecentMenuManager::addEntry
void addEntry(const QString &path)
Ensures an entry for the specified path is present and the first entry in the list.
Definition recentmenumanager.cpp:82
QtUtilities::RecentMenuManager::fileSelected
void fileSelected(const QString &path)
Emitted after the user selected a file.
QtUtilities::RecentMenuManager::save
QStringList save()
Saves the current entries.
Definition recentmenumanager.cpp:64
QtUtilities::RecentMenuManager::restore
void restore(const QStringList &savedEntries)
Restores the specified entries.
Definition recentmenumanager.cpp:44
QtUtilities::RecentMenuManager::RecentMenuManager
RecentMenuManager(QMenu *menu, QObject *parent=nullptr)
Constructs a new recent menu manager.
Definition recentmenumanager.cpp:30
QtUtilities::RecentMenuManager::clearEntries
void clearEntries()
Clears all entries.
Definition recentmenumanager.cpp:120
global.h
QT_UTILITIES_EXPORT
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14
QtUtilities
!
Definition trylocker.h:8