give feedback on which buttons are held down at the top of the button

remapping tab
pull/24/head
John Tsiombikas 2022-03-26 14:15:23 +02:00
rodzic cc9deb96a7
commit 4ad1a11dcc
2 zmienionych plików z 22 dodań i 1 usunięć

Wyświetl plik

@ -257,7 +257,10 @@ void MainWin::updateui()
void MainWin::spnav_input()
{
static unsigned char bnstate[MAX_BUTTONS];
static int maxval = 256;
char bnstr[MAX_BUTTONS * 4 + 20];
char *endp;
spnav_event ev;
QLabel *lb;
QPalette cmap;
@ -281,12 +284,23 @@ void MainWin::spnav_input()
lb = bnrow[ev.button.bnum].lb_bidx;
if(ev.button.press) {
bnstate[ev.button.bnum] = 1;
def_cmap = cmap = lb->palette();
cmap.setColor(QPalette::WindowText, Qt::red);
lb->setPalette(cmap);
} else {
bnstate[ev.button.bnum] = 0;
lb->setPalette(def_cmap);
}
strcpy(bnstr, "Buttons pressed:");
endp = bnstr + strlen(bnstr);
for(int i=0; i<devinfo.nbuttons; i++) {
if(bnstate[i]) {
endp += sprintf(endp, " %02d", i);
}
}
ui->lb_bnstate->setText(bnstr);
break;
case SPNAV_EVENT_CFG:

Wyświetl plik

@ -914,6 +914,13 @@
<string>Buttons</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="lb_bnstate">
<property name="text">
<string>Buttons pressed:</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scroll_area_buttons">
<property name="widgetResizable">
@ -925,7 +932,7 @@
<x>0</x>
<y>0</y>
<width>758</width>
<height>378</height>
<height>355</height>
</rect>
</property>
</widget>