Qt: Allow rebinding keyboard controls (#779)
* Initial input UI draft Co-Authored-By: Paris Oplopoios <parisoplop@gmail.com> * More keybinding work Co-Authored-By: Paris Oplopoios <parisoplop@gmail.com> * Nit Co-Authored-By: Paris Oplopoios <parisoplop@gmail.com> * More nits Co-Authored-By: Paris Oplopoios <parisoplop@gmail.com> --------- Co-authored-by: Paris Oplopoios <parisoplop@gmail.com>
This commit is contained in:
32
include/panda_qt/input_window.hpp
Normal file
32
include/panda_qt/input_window.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QKeySequence>
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "input_mappings.hpp"
|
||||
|
||||
class InputWindow : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputWindow(QWidget* parent = nullptr);
|
||||
|
||||
void loadFromMappings(const InputMappings& mappings);
|
||||
void applyToMappings(InputMappings& mappings) const;
|
||||
|
||||
signals:
|
||||
void mappingsChanged();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
private:
|
||||
QMap<QString, QPushButton*> buttonMap;
|
||||
QMap<QString, QKeySequence> keyMappings;
|
||||
|
||||
QString waitingForAction;
|
||||
|
||||
void startKeyCapture(const QString& action);
|
||||
};
|
||||
Reference in New Issue
Block a user