pqRecentFilesMenu.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqRecentFilesMenu_h
5 #define pqRecentFilesMenu_h
6 
7 #include <QObject>
8 
9 #include "pqComponentsModule.h" // needed for export macros
10 #include <QPointer> // needed for QPointer
11 
12 class pqServer;
13 class pqServerResource;
14 class QAction;
15 class QMenu;
16 
35 class PQCOMPONENTS_EXPORT pqRecentFilesMenu : public QObject
36 {
37  Q_OBJECT
38 
39 public:
43  pqRecentFilesMenu(QMenu& menu, QObject* p = nullptr);
44  ~pqRecentFilesMenu() override;
45 
49  virtual bool open(pqServer* server, const pqServerResource& resource) const;
50 
58  void setSortByServers(bool val) { this->SortByServers = val; }
59  bool sortByServers() const { return this->SortByServers; }
60 
61 private Q_SLOTS:
62  void buildMenu();
63  void onOpenResource(QAction*);
64  void onOpenResource(const pqServerResource& resource);
65 
66 private: // NOLINT(readability-redundant-access-specifiers)
68  pqRecentFilesMenu& operator=(const pqRecentFilesMenu&);
69 
70  QPointer<QMenu> Menu;
71  bool SortByServers;
72 };
73 
74 #endif // !pqRecentFilesMenu_h
#define PQCOMPONENTS_EXPORT
bool sortByServers() const
manages recent files menu used in ParaView.
void setSortByServers(bool val)
When set to true (default), the menu is arranged to keep resources that use the same server together...
pqServerResource encapsulates a resource in ParaView.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35