# HG changeset patch # User František Kučera # Date 1551974623 -3600 # Node ID b6c0e1574a8b0da1b998d31a2ac12fae03a34dd6 # Parent 49560660d230e447e7d76ec98282a7dd14e22cbb display buttons, motions and rotations of all axes diff -r 49560660d230 -r b6c0e1574a8b src/SpacenavWindow.cpp --- a/src/SpacenavWindow.cpp Thu Mar 07 16:20:51 2019 +0100 +++ b/src/SpacenavWindow.cpp Thu Mar 07 17:03:43 2019 +0100 @@ -22,6 +22,21 @@ widget.setupUi(this); resize(640, 480); setWindowTitle("Spacenav Demo"); + + std::vector buttons{ widget.button0, widget.button1}; + for (QCheckBox* b : buttons) b->setEnabled(false); + + std::vector motions{ + widget.motionX, widget.motionY, widget.motionZ, + widget.rotationX, widget.rotationY, widget.rotationZ + }; + + for (QProgressBar* m : motions) { + m->setMinimum(-500); + m->setMaximum(500); + m->setValue(0); + m->setFormat("%v"); + } } SpacenavWindow::~SpacenavWindow() { @@ -29,10 +44,15 @@ void SpacenavWindow::spacenavMotionEvent(SpacenavWrapper::Event::MotionEvent e) { setWindowTitle("m event!"); + widget.motionX->setValue(e.x); + widget.motionY->setValue(e.y); + widget.motionZ->setValue(e.z); + widget.rotationX->setValue(e.rx); + widget.rotationY->setValue(e.ry); + widget.rotationZ->setValue(e.rz); } void SpacenavWindow::spacenavButtonEvent(SpacenavWrapper::Event::ButtonEvent e) { - setWindowTitle("b event!"); if (e.number == 0) widget.button0->setChecked(e.pressed); if (e.number == 1) widget.button1->setChecked(e.pressed); } diff -r 49560660d230 -r b6c0e1574a8b src/SpacenavWindow.ui --- a/src/SpacenavWindow.ui Thu Mar 07 16:20:51 2019 +0100 +++ b/src/SpacenavWindow.ui Thu Mar 07 17:03:43 2019 +0100 @@ -6,66 +6,145 @@ 0 0 - 800 - 600 + 579 + 346 SpacenavWindow - - - - 130 - 40 - 111 - 111 - - - - - - - 40 - 40 - 80 - 111 - - - - left - - - true - - - false - - - - - - 260 - 40 - 80 - 111 - - - - right - - - true - - + + + + + Button + + + + + + + left + + + + + + + Button + + + + + + + right + + + + + + + Motion: + + + + + + + X + + + + + + + + + + Y + + + + + + + Z + + + + + + + Rotation: + + + + + + + Y + + + + + + + Z + + + + + + + 24 + + + + + + + 24 + + + + + + + 24 + + + + + + + 24 + + + + + + + X + + + + + + + 24 + + + + 0 0 - 800 + 579 23