QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsconfigureshortcutsdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsconfigureshortcutsdialog.h
3  -----------------------------
4  begin : May 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSCONFIGURESHORTCUTSDIALOG_H
17 #define QGSCONFIGURESHORTCUTSDIALOG_H
18 
19 #include <QDialog>
20 
21 #include "ui_qgsconfigureshortcutsdialog.h"
22 #include "qgsshortcutsmanager.h"
23 
24 class QShortcut;
25 
32 class GUI_EXPORT QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsConfigureShortcutsDialog
33 {
34  Q_OBJECT
35 
36  public:
37 
43  QgsConfigureShortcutsDialog( QWidget* parent = nullptr, QgsShortcutsManager* manager = nullptr );
44 
46 
47  protected:
48  void keyPressEvent( QKeyEvent * event ) override;
49  void keyReleaseEvent( QKeyEvent * event ) override;
50 
51  private slots:
52  void changeShortcut();
53  void resetShortcut();
54  void setNoShortcut();
55  void saveShortcuts();
56  void loadShortcuts();
57 
58  void actionChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );
59 
60  private:
61 
63  void saveState();
64 
66  void restoreState();
67 
69  void populateActions();
70 
72  QObject* currentObject();
73 
75  QAction* currentAction();
76 
78  QShortcut* currentShortcut();
79 
80  void setGettingShortcut( bool getting );
81  void setCurrentActionShortcut( const QKeySequence& s );
82  void updateShortcutText();
83 
84  QgsShortcutsManager* mManager;
85 
86  bool mGettingShortcut;
87  int mModifiers, mKey;
88 
89 };
90 
91 #endif //QGSCONFIGURESHORTCUTSDIALOG_H
virtual void keyReleaseEvent(QKeyEvent *event)
Shortcuts manager is a class that contains a list of QActions and QShortcuts that have been registere...
virtual void keyPressEvent(QKeyEvent *e)
Reusable dialog for allowing users to configure shortcuts contained in a QgsShortcutsManager.