pqModalShortcut.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 pqModalShortcut_h
5 #define pqModalShortcut_h
6 
7 #include "pqProxy.h"
8 #include <QKeySequence>
9 #include <QObject>
10 
11 class QAction;
12 class QShortcut;
13 class pqModalShortcut;
14 
21 class PQCORE_EXPORT pqModalShortcut : public QObject
22 {
23  Q_OBJECT;
24 
25 public:
26  using Superclass = QObject;
27  ~pqModalShortcut() override;
28 
32  void setContextWidget(
33  QWidget* contextWidget, Qt::ShortcutContext contextArea = Qt::WindowShortcut);
34 
35  bool isEnabled() const;
36  void setEnabled(bool shouldEnable, bool changeFocus = true);
37 
38  QKeySequence keySequence() const;
39 
40 Q_SIGNALS:
48  void enabled();
49 
54  void disabled();
55 
59  void unregister();
60 
62  void activated();
63 
64 protected:
65  friend class pqKeySequences;
66  pqModalShortcut(const QKeySequence& key, QAction* action = nullptr, QWidget* parent = nullptr);
67 
68  QKeySequence m_key;
69  QPointer<QShortcut> m_shortcut;
70  QPointer<QAction> m_action;
71 };
72 
73 #endif
QKeySequence m_key
Manage an action and/or widget&#39;s responsivity to a shortcut.
QPointer< QAction > m_action
QPointer< QShortcut > m_shortcut
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
enabled
Manage key sequences used for shortcuts.