kopia lustrzana https://github.com/FreeSpacenav/spnavcfg
give feedback on which buttons are held down at the top of the button
remapping tabpull/24/head
rodzic
cc9deb96a7
commit
4ad1a11dcc
14
src/ui.cc
14
src/ui.cc
|
@ -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:
|
||||
|
|
|
@ -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>
|
||||
|
|
Ładowanie…
Reference in New Issue