File: axisw.cpp

package info (click to toggle)
qjoypad 4.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 436 kB
  • sloc: cpp: 3,121; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "axisw.h"


AxisWidget::AxisWidget( Axis* a, QWidget* parent )
        : FlashButton(QString(), QString(), parent) {
    axis = a;
    ae = NULL;
    update();
    on = false;
}

void AxisWidget::jsevent( int val ) {
    bool newOn = !axis->inDeadZone(val);
    if (on != newOn) {
        on = newOn;
        flash();
    }
    if (ae != NULL) ae->setState(val);
}

void AxisWidget::update() {
    setText( axis->status());
}

void AxisWidget::mouseReleaseEvent( QMouseEvent* e ) {
    //create the edit dialog,
    ae = new AxisEdit(axis);
    //get its input
    ae->exec();
    //now that it's done, destroy it!
    delete ae;
    //and remember that it's gone.
    ae = NULL;
    update();
    //release the button. Waiting to do this until the very end has the nice
    //effect of keeping the button depressed while the dialog is shown.
    FlashButton::mouseReleaseEvent( e );
}