KRecentFilesMenu Class
A menu that offers a set of recent files. More...
- Header:
#include <KRecentFilesMenu> - CMake:
find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons) - Inherits: QMenu
List of all members, including inherited members
Public Functions
- KRecentFilesMenu(QWidget *parent = nullptr)
- KRecentFilesMenu(const QString &title, QWidget *parent = nullptr)
- void addUrl(const QUrl &url, const QString &name = QString())
- QString group() const
- int maximumItems() const
- QList<QUrl> recentFiles() const
- void removeUrl(const QUrl &url)
- void setGroup(const QString &group)
- void setMaximumItems(size_t maximumItems)
Public Slots
Signals
Detailed Description
Member Function Documentation
[explicit] KRecentFilesMenu::KRecentFilesMenu(QWidget *parent = nullptr)
[explicit] KRecentFilesMenu::KRecentFilesMenu(const QString &title, QWidget *parent = nullptr)
void KRecentFilesMenu::addUrl(const QUrl &url, const QString &name = QString())
Add URL to recent files list. This will enable this action.
url The URL of the file
name The user visible pretty name that appears before the URL
[slot] void KRecentFilesMenu::clearRecentFiles()
Clear recent files list.
See also recentFiles(), recentFilesChanged()
QString KRecentFilesMenu::group() const
The group the URLs are saved to/read from. Unless a group is specified by setGroup "RecentFiles" is used.
See also setGroup()
int KRecentFilesMenu::maximumItems() const
The maximum number of files this menu can hold.
When the maximum url count is reached and a new URL is added the oldest will be replaced.
By default maximum 10 URLs are shown.
See also setMaximumItems()
QList<QUrl> KRecentFilesMenu::recentFiles() const
List of URLs of recent files.
See also clearRecentFiles(), recentFilesChanged()
[signal] void KRecentFilesMenu::recentFilesChanged()
Emitted when the recent files list has been changed.
See also recentFiles(), clearRecentFiles()
void KRecentFilesMenu::removeUrl(const QUrl &url)
Remove a URL from the recent files list.
url The URL of the file
void KRecentFilesMenu::setGroup(const QString &group)
Specify a group for storing the URLs. This allows e.g. storing multiple types of recent files.
By default the group "RecentFiles" is used.
group the name of the group.
See also group()
void KRecentFilesMenu::setMaximumItems(size_t maximumItems)
Set the maximum URL count.
See also maximumItems()
[signal] void KRecentFilesMenu::urlTriggered(const QUrl &url)
Emitted when the user clicks on a file action.
Usually this should result in the specified URL being opened.
url The url associated with the triggered action.