BibleTime
btshortcutsdialog.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include <QDialog>
16 
17 #include <QKeySequence>
18 #include <QObject>
19 #include <QString>
20 #include <Qt>
21 
22 
23 class QKeyEvent;
24 class QLabel;
25 class QRadioButton;
26 class QWidget;
27 
28 // *************** BtShortcutsDialog ***************************************************************************
29 // A dialog to allow the user to input a shortcut for a primary and alternate key
30 
31 class BtShortcutsDialog : public QDialog {
32  Q_OBJECT
33  public:
34 
35  explicit BtShortcutsDialog(QWidget * parent = nullptr,
36  Qt::WindowFlags f = Qt::WindowFlags());
37 
38  // get new first keys from dialog
39  QString getFirstKeys();
40 
41  // set the initial value of the first keys
42  void setFirstKeys(const QString& keys);
43 
44  // get new second keys from dialog
45  QString getSecondKeys();
46 
47  // set the initial value of the second keys
48  void setSecondKeys(const QString& keys);
49 
50  // change the First or Second shortcut in the dialog
51  void changeSelectedShortcut(QKeySequence const & keys);
52 
53  Q_SIGNALS:
54  // make a keyChangeRequest back to the application
55  void keyChangeRequest(QKeySequence const & keys);
56 
57  protected:
58  // get key from users input, put into primary or alternate label for display to user
59  void keyReleaseEvent(QKeyEvent* event) override;
60 
61  private: // methods:
62 
63  void retranslateUi();
64 
65  private:
66  QLabel* m_primaryLabel;
68  QRadioButton* m_primaryButton;
69  QRadioButton* m_alternateButton;
70 };
void keyReleaseEvent(QKeyEvent *event) override
QRadioButton * m_alternateButton
BtShortcutsDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
void changeSelectedShortcut(QKeySequence const &keys)
QRadioButton * m_primaryButton
void keyChangeRequest(QKeySequence const &keys)
void setFirstKeys(const QString &keys)
void setSecondKeys(const QString &keys)