OpenMS
3.6.0
Main Page
Related Pages
Topics
Namespaces
Concepts
Classes
Files
File List
File Members
Loading...
Searching...
No Matches
RecentFilesMenu.h
Go to the documentation of this file.
1
// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2
// SPDX-License-Identifier: BSD-3-Clause
3
//
4
// --------------------------------------------------------------------------
5
// $Maintainer: Chris Bielow $
6
// $Authors: Chris Bielow $
7
// --------------------------------------------------------------------------
8
9
#pragma once
10
11
// OpenMS_GUI config
12
#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
14
#include <
OpenMS/KERNEL/StandardTypes.h
>
15
16
#include <QMenu>
17
#include <QStringList>
18
19
#include <vector>
20
21
class
QAction;
22
23
namespace
OpenMS
24
{
25
class
Param;
26
32
class
RecentFilesMenu
33
:
public
QObject
34
{
35
Q_OBJECT
36
37
signals:
39
void
recentFileClicked
(
const
std::string& filename);
40
41
public
:
43
RecentFilesMenu
(
int
max_entries = 15);
44
46
void
set
(
const
QStringList& initial);
47
56
unsigned
setFromParam
(
const
Param
& filenames);
57
62
Param
getAsParam
()
const
;
63
65
QMenu*
getMenu
();
66
68
const
QStringList&
get
()
const
;
69
70
public
slots:
72
void
add
(
const
std::string& filename);
73
74
private
slots:
76
void
itemClicked_
();
77
78
private
:
80
void
sync_
();
81
83
QMenu
recent_menu_
;
85
int
max_entries_
;
87
QStringList
recent_files_
;
89
std::vector<QAction*>
recent_actions_
;
90
};
91
92
}
//namespace
93
StandardTypes.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition
Param.h:46
OpenMS::RecentFilesMenu
Manages recent files opened by the user and provides a QMenu to go with it.
Definition
RecentFilesMenu.h:34
OpenMS::RecentFilesMenu::recentFileClicked
void recentFileClicked(const std::string &filename)
when a recent file action item from the getMenu() was clicked
OpenMS::RecentFilesMenu::getAsParam
Param getAsParam() const
Convert current file list to Param. Their names are just numbers, starting at "0"....
OpenMS::RecentFilesMenu::RecentFilesMenu
RecentFilesMenu(int max_entries=15)
C'tor.
OpenMS::RecentFilesMenu::recent_actions_
std::vector< QAction * > recent_actions_
.. and the actions to go with it
Definition
RecentFilesMenu.h:89
OpenMS::RecentFilesMenu::recent_files_
QStringList recent_files_
list of the recently opened files actions (menu entries)
Definition
RecentFilesMenu.h:87
OpenMS::RecentFilesMenu::setFromParam
unsigned setFromParam(const Param &filenames)
Extracts all values from all elements in the param object and tries to interpret them as filenames If...
OpenMS::RecentFilesMenu::get
const QStringList & get() const
current list of recent files (most recent first)
OpenMS::RecentFilesMenu::itemClicked_
void itemClicked_()
invoked by the QAction when it was clicked; emits recentFileClicked(std::string filename)
OpenMS::RecentFilesMenu::add
void add(const std::string &filename)
put a new recent file at the top (removing any duplicates in other positions); will update the QMenu
OpenMS::RecentFilesMenu::sync_
void sync_()
updates the menu by synching text and and visibility of actions using the current list of recent file...
OpenMS::RecentFilesMenu::recent_menu_
QMenu recent_menu_
holds the menu and the filenames (as QActions)
Definition
RecentFilesMenu.h:83
OpenMS::RecentFilesMenu::max_entries_
int max_entries_
maximum of entries; adding more will delete the oldest one
Definition
RecentFilesMenu.h:85
OpenMS::RecentFilesMenu::set
void set(const QStringList &initial)
sets a list of recent files (up to max_entries many – see C'tor)
OpenMS::RecentFilesMenu::getMenu
QMenu * getMenu()
get a menu-pointer to an internal member which always contains the up-to-date recent items
QObject
OpenMS
Main OpenMS namespace.
Definition
openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
OpenMS
VISUAL
RecentFilesMenu.h
Generated on Thu Jun 11 2026 10:57:56 for OpenMS by
1.9.8