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
QtUtilities::RecentMenuManager Class Reference

The RecentMenuManager class manages the entries for a "recently opened files" menu. More...

#include <recentmenumanager.h>

Inheritance diagram for QtUtilities::RecentMenuManager:
[legend]
Collaboration diagram for QtUtilities::RecentMenuManager:
[legend]

Public Slots

void restore (const QStringList &savedEntries)
 Restores the specified entries.
 
QStringList save ()
 Saves the current entries.
 
void addEntry (const QString &path)
 Ensures an entry for the specified path is present and the first entry in the list.
 
void clearEntries ()
 Clears all entries.
 

Signals

void fileSelected (const QString &path)
 Emitted after the user selected a file.
 

Public Member Functions

 RecentMenuManager (QMenu *menu, QObject *parent=nullptr)
 Constructs a new recent menu manager.
 

Detailed Description

The RecentMenuManager class manages the entries for a "recently opened files" menu.

Definition at line 13 of file recentmenumanager.h.

Constructor & Destructor Documentation

◆ RecentMenuManager()

QtUtilities::RecentMenuManager::RecentMenuManager ( QMenu * menu,
QObject * parent = nullptr )

Constructs a new recent menu manager.

Parameters
menuSpecifies the QMenu instance to operate with.
parentSpecifies the parent QObject; might be nullptr.
Remarks
  • Menu title and icon are set within the constructor.
  • The current menu entries are cleared.
  • The menu entries shouldn't be manipulated manually by the caller till the manager is destructed.
  • The manager does not take ownership over menu.

Definition at line 30 of file recentmenumanager.cpp.

Member Function Documentation

◆ addEntry

void QtUtilities::RecentMenuManager::addEntry ( const QString & path)
slot

Ensures an entry for the specified path is present and the first entry in the list.

Definition at line 82 of file recentmenumanager.cpp.

◆ clearEntries

void QtUtilities::RecentMenuManager::clearEntries ( )
slot

Clears all entries.

Definition at line 120 of file recentmenumanager.cpp.

◆ fileSelected

void QtUtilities::RecentMenuManager::fileSelected ( const QString & path)
signal

Emitted after the user selected a file.

Remarks
Only emitted when the selected file still existed; otherwise the user is ask whether to keep or delete the entry.

◆ restore

void QtUtilities::RecentMenuManager::restore ( const QStringList & savedEntries)
slot

Restores the specified entries.

Definition at line 44 of file recentmenumanager.cpp.

◆ save

QStringList QtUtilities::RecentMenuManager::save ( )
slot

Saves the current entries.

Definition at line 64 of file recentmenumanager.cpp.


The documentation for this class was generated from the following files: