Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkHotkeyLineEdit.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkHotkeyLineEdit_h
14 #define QmitkHotkeyLineEdit_h
15 
17 
18 // qt
19 #include <QKeySequence>
20 #include <QLineEdit>
21 
34 {
35  Q_OBJECT
36 
37 public:
39  static const std::string TOOLTIP;
40 
45  QmitkHotkeyLineEdit(QWidget* parent = nullptr);
46 
52  QmitkHotkeyLineEdit(const QKeySequence& qKeySequence, QWidget* parent = nullptr);
53 
59  QmitkHotkeyLineEdit(const QString& qQString, QWidget* parent = nullptr);
60 
65  virtual void SetKeySequence(const QKeySequence& qKeySequence);
66 
71  virtual void SetKeySequence(const QString& qKeySequenceAsString);
72 
77  virtual QKeySequence GetKeySequence();
78 
83  virtual QString GetKeySequenceAsString();
84 
90  bool Matches(QKeyEvent *event);
91 
92 protected Q_SLOTS:
93 
94  void LineEditTextChanged(const QString&);
95 
96 protected:
97 
98  void keyPressEvent(QKeyEvent* event) override;
99  void Init();
100 
101  QKeySequence m_KeySequence;
102 
103 };
104 
105 #endif
#define MITKQTWIDGETSEXT_EXPORT
A QLineEdit that captures keyboard shortcuts (hotkeys).
virtual QString GetKeySequenceAsString()
Get the currently configured key sequence as a string.
void keyPressEvent(QKeyEvent *event) override
static const std::string TOOLTIP
Default tooltip text displayed on the widget.
virtual QKeySequence GetKeySequence()
Get the currently configured key sequence.
bool Matches(QKeyEvent *event)
Check whether a key event matches the stored key sequence.
QmitkHotkeyLineEdit(const QKeySequence &qKeySequence, QWidget *parent=nullptr)
Construct a hotkey line edit with an initial key sequence.
virtual void SetKeySequence(const QKeySequence &qKeySequence)
Programmatically set the key sequence.
virtual void SetKeySequence(const QString &qKeySequenceAsString)
Programmatically set the key sequence from a string.
QmitkHotkeyLineEdit(const QString &qQString, QWidget *parent=nullptr)
Construct a hotkey line edit with an initial key sequence string.
void LineEditTextChanged(const QString &)
QmitkHotkeyLineEdit(QWidget *parent=nullptr)
Construct a hotkey line edit with no initial key sequence.