File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,11 @@ void MainWindow::updateChannel(Channel *channel)
7474
7575void MainWindow::processBtnClick (qint8 btn)
7676{
77+ qDebug () << " Pressed Btn" << btn;
78+
7779 UserctrlButton *btnData = this ->btnData ->value (btn);
80+ if (btnData == nullptr ) return ;
81+
7882 switch (btnData->type ) {
7983 case X32ConfigBtn::BtnMute:
8084 emit mute (btnData->data .right (2 ).toInt ());
@@ -87,6 +91,19 @@ void MainWindow::processBtnClick(qint8 btn)
8791 }
8892}
8993
94+ void MainWindow::keyPressEvent (QKeyEvent *event)
95+ {
96+ qDebug () << " Pressed Key:" << event->key ();
97+
98+ int key = event->key ();
99+
100+ if (key >= Qt::Key_F1 && key <= Qt::Key_F9) {
101+ int fKey = key - Qt::Key_F1 + 1 ;
102+ qDebug () << " Pressed: F" << fKey ;
103+ processBtnClick (fKey + 4 + ((fKey > 3 ) ? 1 : 0 ) );
104+ }
105+ }
106+
90107// Layout:
91108// 5 6 7 | 8
92109// 9 10 11 | 12
Original file line number Diff line number Diff line change 1111#include < QListWidget>
1212#include < QTreeWidgetItem>
1313#include < QListWidgetItem>
14+ #include < QKeyEvent>
1415
1516#include < x32Types/x32status.h>
1617#include < x32Types/channel.h>
@@ -34,6 +35,8 @@ class MainWindow : public QMainWindow
3435 ~MainWindow ();
3536
3637 void processBtnClick (qint8 btn);
38+
39+ void keyPressEvent (QKeyEvent* event) override ;
3740
3841private:
3942 Ui::MainWindow *ui;
You can’t perform that action at this time.
0 commit comments